@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
32 lines • 1.6 kB
TypeScript
import type { Account, AccountLike } from "@ledgerhq/types-live";
import type { Transaction, TransactionStatus } from "../generated/types";
import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
export type State<T extends Transaction = Transaction> = {
account: AccountLike | null | undefined;
parentAccount: Account | null | undefined;
transaction: T | null | undefined;
status: TransactionStatus;
statusOnTransaction: T | null | undefined;
errorAccount: Error | null | undefined;
errorStatus: Error | null | undefined;
syncing: boolean;
synced: boolean;
};
export type Result<T extends Transaction = Transaction> = {
transaction: T | null | undefined;
setTransaction: (arg0: T) => void;
updateTransaction: (updater: (arg0: T) => T) => void;
account: AccountLike | null | undefined;
parentAccount: Account | null | undefined;
setAccount: (arg0: AccountLike, arg1: Account | null | undefined) => void;
status: TransactionStatus;
bridgeError: Error | null | undefined;
bridgePending: boolean;
};
export declare const shouldSyncBeforeTx: (currency: CryptoCurrency) => boolean;
declare const useBridgeTransaction: <T extends Transaction = Transaction>(optionalInit?: (() => Partial<State<T>>) | null | undefined) => Result<T>;
type GlobalBridgeErrorFn = null | ((error: any) => void);
export declare function setGlobalOnBridgeError(f: GlobalBridgeErrorFn): void;
export declare function getGlobalOnBridgeError(): GlobalBridgeErrorFn;
export default useBridgeTransaction;
//# sourceMappingURL=useBridgeTransaction.d.ts.map