import type { TargetNamespace, Wallet } from './shared'; import type { Provider } from '@hub3js/core'; import type { DefaultNamespaces } from '@hub3js/namespaces'; import type { QueueContext, QueueDef, QueueStorage } from '@arthur2079/queue-manager-core'; import type { LegacyConnectResult as ConnectResult } from '@arthur2079/wallets-core/legacy'; import type { Meta, Network, Providers, WalletState, WalletType } from '@arthur2079/wallets-shared'; import type { Transaction } from 'rango-sdk'; import type { APIErrorCode, EvmBlockchainMeta, PendingSwap, PendingSwapStep, SignerFactory } from 'rango-types'; export type RemoveNameField = { [Property in keyof T as Exclude]: T[Property]; }; export type ArrayElement = A extends readonly (infer T)[] ? T : never; export type SwapQueueDef = QueueDef; export interface SwapStorage extends QueueStorage { swapDetails: PendingSwap; } export declare enum SwapActionTypes { START = "START", SCHEDULE_NEXT_STEP = "SCHEDULE_NEXT_STEP", CREATE_TRANSACTION = "CREATE_TRANSACTION", CHECK_PREREQUISITES = "CHECK_PREREQUISITES", CHECK_XRPL_TRUSTLINE = "CHECK_XRPL_TRUSTLINE", CHECK_STELLAR_TRUSTLINE = "CHECK_STELLAR_TRUSTLINE", CHECK_XRPL_TRUSTLINE_TRANSACTION_STATUS = "CHECK_XRPL_TRUSTLINE_TRANSACTION_STATUS", EXECUTE_TRANSACTION = "EXECUTE_TRANSACTION", EXECUTE_XRPL_TRANSACTION = "EXECUTE_XRPL_TRANSACTION", EXECUTE_STELLAR_TRANSACTION = "EXECUTE_STELLAR_TRANSACTION", EXECUTE_HYPERLIQUID_TRANSACTION = "EXECUTE_HYPERLIQUID_TRANSACTION", CHECK_HYPERLIQUID_TRANSACTION_STATUS = "CHECK_HYPERLIQUID_TRANSACTION_STATUS", CHECK_TRANSACTION_STATUS = "CHECK_TRANSACTION_STATUS" } export type GetCurrentAddress = (type: WalletType, network: Network) => string | undefined; export declare enum BlockReason { WAIT_FOR_CONNECT_WALLET = "waiting_for_connecting_wallet", WAIT_FOR_NETWORK_CHANGE = "waiting_for_network_change", DEPENDS_ON_OTHER_QUEUES = "depends_on_other_queues" } export interface Block { reason: BlockReason; description: string; details?: T; } export interface SwapQueueContext extends QueueContext { meta: Meta; wallets: Wallet | null; providers: Providers; hubProvider: (type: WalletType) => Provider; getSigners: (type: WalletType) => Promise; switchNetwork: (wallet: WalletType, namespaces: TargetNamespace) => Promise | undefined; canSwitchNetworkTo: UseQueueManagerParams['canSwitchNetworkTo']; state: (type: WalletType) => WalletState; isMobileWallet: (type: WalletType) => boolean; claimedBy?: string; resetClaimedBy?: () => void; } export type LastConnectedWallet = { walletType: string; network?: string; accounts?: string[]; }; export interface UseQueueManagerParams { lastConnectedWallet: LastConnectedWallet | null; disconnectedWallet: WalletType | undefined; clearDisconnectedWallet: () => void; evmChains: EvmBlockchainMeta[]; canSwitchNetworkTo: (type: WalletType, network: Network, namespace: TargetNamespace) => boolean; } export declare enum WidgetEvents { RouteEvent = "routeEvent", StepEvent = "stepEvent" } export type Step = Pick & { swapperName: string; transaction: Transaction | null; }; export type Route = Pick & { steps: Step[]; slippage: string; infiniteApproval?: boolean; }; export type SwapEvent = RouteEvent | StepEvent; export declare enum RouteEventType { STARTED = "started", FAILED = "failed", SUCCEEDED = "succeeded" } export declare enum StepExecutionEventStatus { CREATE_TX = "create_tx", SEND_TX = "send_tx", TX_SENT = "tx_sent" } export declare enum StepExecutionBlockedEventStatus { WAITING_FOR_QUEUE = "waiting_for_queue", WAITING_FOR_WALLET_CONNECT = "waiting_for_wallet_connect", WAITING_FOR_NETWORK_CHANGE = "waiting_for_network_change", WAITING_FOR_CHANGE_WALLET_ACCOUNT = "waiting_for_change_wallet_account" } export declare enum StepEventType { STARTED = "started", FAILED = "failed", SUCCEEDED = "succeeded", TX_EXECUTION = "tx_execution", TX_EXECUTION_BLOCKED = "tx_execution_blocked", APPROVAL_TX_SUCCEEDED = "approval_tx_succeeded", CHECK_STATUS = "check_status", OUTPUT_REVEALED = "output_revealed" } export declare enum EventSeverity { ERROR = "error", SUCCESS = "success", WARNING = "warning", INFO = "info" } export type Event = Record> = { type: T; message: string; messageSeverity: EventSeverity; } & U; export type FailedRouteEventPayload = { inputAmount: string; inputAmountUsd: string; reason?: string; reasonCode: APIErrorCode; swapMode: 'swap' | 'refuel'; }; export type FailedStepEventPayload = Omit; export type SucceededRouteEventPayload = { inputAmount: string; inputAmountUsd: string; outputAmount: string; outputAmountUsd: string; swapMode: 'swap' | 'refuel'; }; export type SucceededStepEventPayload = Omit; export type OutputRevealedEventPayload = { outputAmount: string; }; export type StepExecutionEventPayload = { status: StepExecutionEventStatus.CREATE_TX | StepExecutionEventStatus.SEND_TX | StepExecutionEventStatus.TX_SENT; }; export type StepBlockedEventPayload = { status: StepExecutionBlockedEventStatus.WAITING_FOR_QUEUE; } | { status: StepExecutionBlockedEventStatus.WAITING_FOR_WALLET_CONNECT; requiredWallet?: string; requiredAccount?: string; } | { status: StepExecutionBlockedEventStatus.WAITING_FOR_CHANGE_WALLET_ACCOUNT; requiredAccount?: string; } | { status: StepExecutionBlockedEventStatus.WAITING_FOR_NETWORK_CHANGE; currentNetwork?: string; requiredNetwork?: string; }; export type RouteStartedEvent = Event; export type RouteFailedEvent = Event; export type RouteSucceededEvent = Event; export type StepStartedEvent = Event; export type StepSucceededEvent = Event; export type StepFailedEvent = Event; export type StepTxExecutionUpdatedEvent = Event; export type StepTxExecutionBlockedEvent = Event; export type StepCheckStatusEvent = Event; export type StepApprovalTxSucceededEvent = Event; export type StepOutputRevealedEvent = Event; export type StepEvent = StepStartedEvent | StepSucceededEvent | StepFailedEvent | StepTxExecutionUpdatedEvent | StepTxExecutionBlockedEvent | StepCheckStatusEvent | StepApprovalTxSucceededEvent | StepOutputRevealedEvent; export type RouteEvent = RouteStartedEvent | RouteSucceededEvent | RouteFailedEvent; export type RouteEventData = { route: Route; event: RouteEvent; }; export type StepEventData = { route: Route; step: Step; event: StepEvent; }; export type RouteExecutionEvents = { [WidgetEvents.RouteEvent]: RouteEventData; [WidgetEvents.StepEvent]: StepEventData; }; //# sourceMappingURL=types.d.ts.map