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, FeatureFlags } 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; isEmbeddedSwap?: boolean; }; type FundStartParamsUiRequest = { exchangeType: "FUND"; provider: string; exchange: Partial | undefined; }; type SellStartParamsUiRequest = { exchangeType: "SELL"; provider: string; exchange: Partial | undefined; }; type SwapStartParamsUiRequest = { exchangeType: "SWAP"; provider: string; exchange: Partial; }; type ExchangeStartParamsUiRequest = FundStartParamsUiRequest | SellStartParamsUiRequest | SwapStartParamsUiRequest; export type SwapUiRequest = CompleteExchangeUiRequest & { provider?: string; fromAccountId?: string; toAccountId?: string; tokenCurrency?: string; correlationId?: 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, flags, 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; flags?: FeatureFlags; uiHooks: ExchangeUiHooks; }) => { readonly "custom.exchange.start": RPCHandler; readonly "custom.exchange.complete": RPCHandler; readonly "custom.exchange.error": RPCHandler; readonly "custom.exchange.swap": RPCHandler; readonly "custom.isReady": RPCHandler; }; //# sourceMappingURL=server.d.ts.map