@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
50 lines • 1.62 kB
TypeScript
import { Observable } from "rxjs";
import type { Action } from "./types";
import type { AppState } from "./app";
import type { DeviceModelId } from "@ledgerhq/devices";
import { Exchange } from "../../exchange/types";
import { Transaction } from "../../generated/types";
type State = {
completeExchangeResult: Transaction | null | undefined;
completeExchangeError: Error | null | undefined;
freezeReduxDevice: boolean;
completeExchangeRequested: boolean;
isLoading: boolean;
estimatedFees: string | undefined;
};
type CompleteExchangeState = AppState & State;
type CompleteExchangeRequest = {
deviceModelId?: DeviceModelId;
deviceId?: string;
provider: string;
transaction: Transaction;
binaryPayload: string;
signature: string;
exchange: Exchange;
exchangeType: number;
rateType?: number;
swapId?: string;
rate?: number;
amountExpectedTo?: number;
};
type Result = {
completeExchangeResult: Transaction;
} | {
completeExchangeError: Error;
};
type CompleteExchangeAction = Action<CompleteExchangeRequest, CompleteExchangeState, Result>;
export type ExchangeRequestEvent = {
type: "complete-exchange";
} | {
type: "complete-exchange-requested";
estimatedFees: string;
} | {
type: "complete-exchange-error";
error: Error;
} | {
type: "complete-exchange-result";
completeExchangeResult: Transaction;
};
export declare const createAction: (completeExchangeExec: (arg0: CompleteExchangeRequest) => Observable<ExchangeRequestEvent>) => CompleteExchangeAction;
export {};
//# sourceMappingURL=completeExchange.d.ts.map