@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
80 lines • 5.46 kB
TypeScript
import type { AppManifest, BroadcastTrackingData, DAppTrackingData } from "./types";
/**
* This signature is to be compatible with track method of `segment.js` file in LLM and LLD
* `track(event: string, properties: ?Object, mandatory: ?boolean)` in jsflow
* {@link @ledger-desktop/renderer/analytics/segment#track}
*/
type TrackWalletAPI = (event: string, properties: Record<string, any> | null, mandatory: boolean | null) => void;
/**
* Wrap call to underlying trackCall function.
* @param trackCall
* @returns a dictionary of event to trigger.
*/
export default function trackingWrapper(trackCall: TrackWalletAPI): {
readonly load: (manifest: AppManifest) => void;
readonly reload: (manifest: AppManifest) => void;
readonly loadFail: (manifest: AppManifest) => void;
readonly loadSuccess: (manifest: AppManifest) => void;
readonly signTransactionRequested: (manifest: AppManifest, isEmbeddedSwap?: boolean, partner?: string) => void;
readonly signTransactionFail: (manifest: AppManifest, isEmbeddedSwap?: boolean, partner?: string) => void;
readonly signTransactionSuccess: (manifest: AppManifest, isEmbeddedSwap?: boolean, partner?: string) => void;
readonly signRawTransactionRequested: (manifest: AppManifest) => void;
readonly signRawTransactionFail: (manifest: AppManifest) => void;
readonly signRawTransactionSuccess: (manifest: AppManifest) => void;
readonly requestAccountRequested: (manifest: AppManifest) => void;
readonly requestAccountFail: (manifest: AppManifest) => void;
readonly requestAccountSuccess: (manifest: AppManifest) => void;
readonly receiveRequested: (manifest: AppManifest) => void;
readonly receiveFail: (manifest: AppManifest) => void;
readonly receiveSuccess: (manifest: AppManifest) => void;
readonly broadcastFail: (manifest: AppManifest, data?: BroadcastTrackingData) => void;
readonly broadcastSuccess: (manifest: AppManifest, data?: BroadcastTrackingData) => void;
readonly broadcastOperationDetailsClick: (manifest: AppManifest) => void;
readonly startExchangeRequested: (manifest: AppManifest) => void;
readonly startExchangeSuccess: (manifest: AppManifest) => void;
readonly startExchangeFail: (manifest: AppManifest) => void;
readonly completeExchangeRequested: (manifest: AppManifest) => void;
readonly completeExchangeSuccess: (manifest: AppManifest) => void;
readonly completeExchangeFail: (manifest: AppManifest) => void;
readonly signMessageRequested: (manifest: AppManifest) => void;
readonly signMessageSuccess: (manifest: AppManifest) => void;
readonly signMessageFail: (manifest: AppManifest) => void;
readonly signMessageUserRefused: (manifest: AppManifest) => void;
readonly deviceTransportRequested: (manifest: AppManifest) => void;
readonly deviceTransportSuccess: (manifest: AppManifest) => void;
readonly deviceTransportFail: (manifest: AppManifest) => void;
readonly deviceSelectRequested: (manifest: AppManifest) => void;
readonly deviceSelectSuccess: (manifest: AppManifest) => void;
readonly deviceSelectFail: (manifest: AppManifest) => void;
readonly deviceOpenRequested: (manifest: AppManifest) => void;
readonly deviceExchangeRequested: (manifest: AppManifest) => void;
readonly deviceExchangeSuccess: (manifest: AppManifest) => void;
readonly deviceExchangeFail: (manifest: AppManifest) => void;
readonly deviceCloseRequested: (manifest: AppManifest) => void;
readonly deviceCloseSuccess: (manifest: AppManifest) => void;
readonly deviceCloseFail: (manifest: AppManifest) => void;
readonly bitcoinFamilyAccountAddressRequested: (manifest: AppManifest) => void;
readonly bitcoinFamilyAccountAddressFail: (manifest: AppManifest) => void;
readonly bitcoinFamilyAccountAddressSuccess: (manifest: AppManifest) => void;
readonly bitcoinFamilyAccountPublicKeyRequested: (manifest: AppManifest) => void;
readonly bitcoinFamilyAccountPublicKeyFail: (manifest: AppManifest) => void;
readonly bitcoinFamilyAccountPublicKeySuccess: (manifest: AppManifest) => void;
readonly bitcoinFamilyAccountXpubRequested: (manifest: AppManifest) => void;
readonly bitcoinFamilyAccountXpubFail: (manifest: AppManifest) => void;
readonly bitcoinFamilyAccountXpubSuccess: (manifest: AppManifest) => void;
readonly bitcoinFamilyAccountAddressesRequested: (manifest: AppManifest) => void;
readonly bitcoinFamilyAccountAddressesFail: (manifest: AppManifest) => void;
readonly bitcoinFamilyAccountAddressesSuccess: (manifest: AppManifest) => void;
readonly dappSendTransactionRequested: (manifest: AppManifest, trackingData: DAppTrackingData) => void;
readonly dappSendTransactionSuccess: (manifest: AppManifest, trackingData: DAppTrackingData) => void;
readonly dappSendTransactionFail: (manifest: AppManifest, trackingData?: DAppTrackingData) => void;
readonly dappPersonalSignRequested: (manifest: AppManifest) => void;
readonly dappPersonalSignSuccess: (manifest: AppManifest) => void;
readonly dappPersonalSignFail: (manifest: AppManifest) => void;
readonly dappSignTypedDataRequested: (manifest: AppManifest) => void;
readonly dappSignTypedDataSuccess: (manifest: AppManifest) => void;
readonly dappSignTypedDataFail: (manifest: AppManifest) => void;
};
export type TrackingAPI = ReturnType<typeof trackingWrapper>;
export {};
//# sourceMappingURL=tracking.d.ts.map