import type { AmountMode } from '../../lib/amountPresets'; import { SwapStatus, type Refuel } from '@layerswap/widget-types'; import { AxiosInstance } from "axios"; import { type ApiResponse } from "@layerswap/widget-types"; import { NetworkWithTokens, Network, Token } from "@layerswap/widget-types"; import { Exchange } from "../../Models/Exchange"; export default class LayerSwapApiClient { static apiBaseEndpoint?: string; static apiKey: string; _authInterceptor: AxiosInstance; _unauthInterceptor: AxiosInstance; constructor(); fetcher: (url: string, options?: { signal?: AbortSignal; }) => Promise>; GetRoutesAsync(direction: 'sources' | 'destinations', _useFrontendSwap?: true): Promise>; GetSourceExchangesAsync(): Promise>; GetLSNetworksAsync(): Promise>; CreateSwapAsync(params: CreateSwapParams): Promise>; GetTransactionStatus(network: string, tx_id: string): Promise>; SwapCatchup(swapId: string, tx_id: string): Promise>; AuthorizeSwapAsync(swapId: string, signature: string, signerAddress: string): Promise>; GetGaslessAuthorizationAsync(swapId: string): Promise>; GetDepositActionsAsync(swapId: string, sourceAddress?: string): Promise>; GetNextActionAsync(swapId: string, sourceAddress?: string): Promise>; GetSwapAsync(swapId: string, sourceAddress?: string): Promise>; private resolveDepositActions; private resolveSwapDepositActions; private AuthenticatedRequest; private UnauthenticatedRequest; } export type DepositAddress = { type: string; address: `0x${string}`; }; export declare enum DepositAddressSource { UserGenerated = 0, Managed = 1 } export type CreateSwapParams = { source_network: string; source_token: string; destination_network: string; destination_token: string; refuel?: boolean; slippage?: string; destination_address: string; source_address?: string; refund_address?: string; amount?: string; reference_id?: string; source_exchange?: string; destination_exchange?: string; use_deposit_address: boolean; use_depository?: boolean; use_gasless: boolean; use_frontend_swap: true; use_atomic_batch?: boolean; app_name?: string; }; export type SwapResponse = { deposit_actions?: DepositAction[]; swap: SwapItem; quote: SwapQuote; refuel?: Refuel; }; export type SwapBasicData = { /** Present only when the backend persisted a frontend settlement leg. */ quote_revision?: number; /** Local amount intent; never serialized as an API parameter. */ amountMode?: AmountMode; amountPresetSource?: string; amountPresetError?: string; amountPresetPending?: boolean; amountPresetBalance?: number; source_network: Network; source_token: Token; source_exchange?: Exchange; destination_network: Network; destination_token: Token; destination_address: string; requested_amount: string; use_deposit_address: boolean; }; export type SwapDetails = { id: string; created_date: string; source_address?: string; status: SwapStatus; transactions: Transaction[]; exchange_account_connected: boolean; exchange_account_name?: string; fail_reason?: string; metadata: { reference_id: string | null; app: string | null; sequence_number: number; }; }; export type SwapItem = { quote_revision?: number; id: string; created_date: string; source_network: Network; source_token: Token; source_exchange?: Exchange; destination_network: Network; destination_token: Token; destination_address: string; source_address?: string; requested_amount: number; use_deposit_address: boolean; status: SwapStatus; transactions: Transaction[]; exchange_account_connected: boolean; exchange_account_name?: string; fail_reason?: string; metadata: { reference_id: string | null; app: string | null; sequence_number: number; }; destination_exchange?: Exchange; }; export type EIP712TypedData = { types: Record; primaryType: string; domain: Record; message: Record; }; export type DepositActionStep = 'approve_permit2' | 'sign' | 'publish' | 'deposit' | string; export type DepositActionStatus = 'action_required' | 'pending' | 'waiting' | 'completed' | 'failed' | string; type DepositActionWorkflow = { step?: DepositActionStep; status?: DepositActionStatus; signing_standard?: string; expires_at?: string; detail?: string; }; type DepositActionBase = DepositActionWorkflow & { amount?: number; amount_in_base_units?: string; call_data?: `0x${string}` | string | null; gas_limit?: string; encoded_args?: string[] | null; from_address?: string; fee?: any | null; network?: Network; order?: number; to_address?: string; token?: Token; fee_token?: Token; valid_after?: number; valid_before?: number; nonce?: string; }; export type TransferDepositAction = DepositActionBase & { type: 'transfer' | 'manual_transfer'; }; export type SignDepositAction = DepositActionBase & { type: 'sign'; typed_data: EIP712TypedData; valid_after?: number; valid_before?: number; nonce?: string; }; export type PendingDepositAction = Partial & { type?: undefined; }; export type BatchTransferDepositAction = DepositActionBase & { type: 'send_calls'; calls: { to: string; data: string | null; value: string; }[]; }; export type NextActionResponse = DepositActionWorkflow & { action?: DepositAction; }; export type DepositAction = TransferDepositAction | SignDepositAction | PendingDepositAction | BatchTransferDepositAction; export type Quote = { quote: SwapQuote; refuel?: Refuel; reward?: QuoteReward; }; export type QuoteReward = { amount: number; amount_in_usd: number; token: Token; network: Network; campaign_type: "for_nft_holders" | "default"; nft_contract_address?: string; }; export type GetQuoteParams = { source_network: string; source_token: string; source_address?: string; destination_network: string; destination_token: string; destination_address: string; use_deposit_address: boolean; use_frontend_swap: true; include_gas?: boolean; amount: number; refuel?: boolean; }; export type SwapQuote = { path?: { provider: string; order: number; }[]; source_network?: Network; source_token?: Token; destination_network?: Network; destination_token?: Token; requested_amount?: number; receive_amount: number; min_receive_amount: number; fee_discount?: number; total_fee: number; total_fee_in_usd: number; blockchain_fee: number; service_fee: number; avg_completion_time: string; refuel_in_source?: number; slippage?: number; rate?: number; }; export type Transaction = { type: TransactionType; from: string; to: string; created_date: string; amount: number; transaction_hash: string; confirmations: number; max_confirmations: number; usd_value: number; usd_price: number; status: BackendTransactionStatus; fee_amount?: number | null; fee_token?: Token; timestamp?: string; }; export declare enum TransactionType { Input = "input", Output = "output", Refuel = "refuel", Refund = "refund" } export declare enum BackendTransactionStatus { Completed = "completed", Failed = "failed", Initiated = "initiated", Pending = "pending" } export declare enum TransactionStatus { Completed = "completed", Failed = "failed", Pending = "pending" } export declare enum DepositType { Manual = "manual", Wallet = "wallet" } export type GaslessAuthorizationStatus = 'initiated' | 'published' | 'completed' | 'expired' | 'insufficient' | 'rejected'; export type GaslessAuthorizationTransaction = { transaction_hash: string; status: BackendTransactionStatus | string; confirmations: number; max_confirmations: number; }; export type GaslessAuthorizationResult = { status: GaslessAuthorizationStatus; transaction?: GaslessAuthorizationTransaction | null; }; export type Fee = { min_amount: number; max_amount: number; fee_amount: number; deposit_type: DepositType; }; export declare enum SwapType { OnRamp = "cex_to_network", OffRamp = "network_to_cex", CrossChain = "network_to_network" } export declare enum WithdrawType { Wallet = "wallet", Manually = "manually", Stripe = "stripe", Coinbase = "coinbase", External = "external" } export type Campaign = { id: number; name: string; display_name: string; description: string | null; logo_url: string | null; token: Token; network: Network; percentage: number; start_date: string; end_date: string; min_payout_amount: number; max_payout_amount: number; total_budget: number; distributed_amount: number; reward_limit_period: number; }; export type Reward = { user_reward: { period_pending_amount: number; total_amount: number; total_amount_in_usd: number; total_pending_amount: number; position: number; }; next_airdrop_date: string | Date; }; export type Leaderboard = { leaderboard: { address: string; amount: number; position: number; }[]; leaderboard_budget: number; }; export type RewardPayout = { date: string; transaction_id: string; amount: number; }; export {}; //# sourceMappingURL=layerSwapApiClient.d.ts.map