import { AccountLike } from "@ledgerhq/types-live";
import { ExchangeCompleteParams, ExchangeCompleteResult, ExchangeStartParams, ExchangeStartResult, ExchangeSwapParams, ExchangeType, SwapLiveError, SwapResult } from "@ledgerhq/wallet-api-exchange-module";
import { RPCHandler } from "@ledgerhq/wallet-api-server";
import { BigNumber } from "bignumber.js";
import { ExchangeSwap } from "../../exchange/swap/types";
import { Exchange } from "../../exchange/types";
import { Transaction } from "../../generated/types";
import { AppManifest } from "../types";
import { TrackingAPI } from "./tracking";
export { ExchangeType };
export type CompleteExchangeUiRequest = {
    provider: string;
    exchange: Exchange;
    transaction: Transaction;
    binaryPayload: string;
    signature: string;
    feesStrategy: string;
    exchangeType: number;
    swapId?: string;
    amountExpectedTo?: number;
    magnitudeAwareRate?: BigNumber;
    refundAddress?: string;
    payoutAddress?: string;
    sponsored?: boolean;
};
type FundStartParamsUiRequest = {
    exchangeType: "FUND";
    provider: string;
    exchange: Partial<Exchange> | undefined;
};
type SellStartParamsUiRequest = {
    exchangeType: "SELL";
    provider: string;
    exchange: Partial<Exchange> | undefined;
};
type SwapStartParamsUiRequest = {
    exchangeType: "SWAP";
    provider: string;
    exchange: Partial<ExchangeSwap>;
};
type ExchangeStartParamsUiRequest = FundStartParamsUiRequest | SellStartParamsUiRequest | SwapStartParamsUiRequest;
export type SwapUiRequest = CompleteExchangeUiRequest & {
    provider?: string;
    fromAccountId?: string;
    toAccountId?: string;
    tokenCurrency?: string;
};
type ExchangeUiHooks = {
    "custom.exchange.start": (params: {
        exchangeParams: ExchangeStartParamsUiRequest;
        onSuccess: (nonce: string, device?: ExchangeStartResult["device"]) => void;
        onCancel: (error: Error, device?: ExchangeStartResult["device"]) => void;
    }) => void;
    "custom.exchange.complete": (params: {
        exchangeParams: CompleteExchangeUiRequest;
        onSuccess: (hash: string) => void;
        onCancel: (error: Error) => void;
    }) => void;
    "custom.exchange.error": (params: {
        error: SwapLiveError | undefined;
        onSuccess: () => void;
        onCancel: () => void;
    }) => void;
    "custom.isReady": (params: {
        onSuccess: () => void;
        onCancel: () => void;
    }) => void;
    "custom.exchange.swap": (params: {
        exchangeParams: SwapUiRequest;
        onSuccess: ({ operationHash, swapId }: {
            operationHash: string;
            swapId: string;
        }) => void;
        onCancel: (error: Error) => void;
    }) => void;
};
export declare const handlers: ({ accounts, tracking, manifest, uiHooks: { "custom.exchange.start": uiExchangeStart, "custom.exchange.complete": uiExchangeComplete, "custom.exchange.error": uiError, "custom.isReady": uiIsReady, "custom.exchange.swap": uiSwap, }, }: {
    accounts: AccountLike[];
    tracking: TrackingAPI;
    manifest: AppManifest;
    uiHooks: ExchangeUiHooks;
}) => {
    readonly "custom.exchange.start": RPCHandler<ExchangeStartResult, ExchangeStartParams>;
    readonly "custom.exchange.complete": RPCHandler<ExchangeCompleteResult, ExchangeCompleteParams>;
    readonly "custom.exchange.error": RPCHandler<void, SwapLiveError>;
    readonly "custom.exchange.swap": RPCHandler<SwapResult, ExchangeSwapParams>;
    readonly "custom.isReady": RPCHandler<void, void>;
};
//# sourceMappingURL=server.d.ts.map