///
import { AppConfigurationResponse, GetAppNameAndVersionResponse, GetPublicKeyParams, GetPublicKeyResponse, LedgerBridge, LedgerSignDelegationAuthorizationParams, LedgerSignDelegationAuthorizationResponse, LedgerSignMessageParams, LedgerSignMessageResponse, LedgerSignTransactionParams, LedgerSignTransactionResponse, LedgerSignTypedDataParams, LedgerSignTypedDataResponse } from "./ledger-bridge.cjs";
export declare enum IFrameMessageAction {
LedgerIsIframeReady = "ledger-is-iframe-ready",
LedgerConnectionChange = "ledger-connection-change",
LedgerUnlock = "ledger-unlock",
LedgerMakeApp = "ledger-make-app",
LedgerUpdateTransport = "ledger-update-transport",
LedgerSignTransaction = "ledger-sign-transaction",
LedgerSignPersonalMessage = "ledger-sign-personal-message",
LedgerSignTypedData = "ledger-sign-typed-data",
LedgerGetAppNameAndVersion = "ledger-get-app-name-and-version",
LedgerGetAppConfiguration = "ledger-get-app-configuration"
}
type IFrameMessageResponseStub, FailureResult = Error> = {
messageId: number;
} & ({
success: true;
payload: SuccessResult;
} | {
success: false;
payload: {
error: FailureResult;
};
});
type LedgerConnectionChangeActionResponse = {
messageId: number;
action: IFrameMessageAction.LedgerConnectionChange;
payload: {
connected: boolean;
};
};
type LedgerMakeAppActionResponse = {
messageId: number;
action: IFrameMessageAction.LedgerMakeApp;
} & ({
success: true;
} | {
success: false;
error?: unknown;
});
type LedgerUpdateTransportActionResponse = {
messageId: number;
action: IFrameMessageAction.LedgerUpdateTransport;
success: boolean;
};
type LedgerUnlockActionResponse = {
action: IFrameMessageAction.LedgerUnlock;
} & IFrameMessageResponseStub;
type LedgerSignTransactionActionResponse = {
action: IFrameMessageAction.LedgerSignTransaction;
} & IFrameMessageResponseStub;
type LedgerSignPersonalMessageActionResponse = {
action: IFrameMessageAction.LedgerSignPersonalMessage;
} & IFrameMessageResponseStub;
type LedgerSignTypedDataActionResponse = {
action: IFrameMessageAction.LedgerSignTypedData;
} & IFrameMessageResponseStub;
type LedgerGetAppNameAndVersionActionResponse = {
action: IFrameMessageAction.LedgerGetAppNameAndVersion;
} & IFrameMessageResponseStub;
type LedgerGetAppConfigurationActionResponse = {
action: IFrameMessageAction.LedgerGetAppConfiguration;
} & IFrameMessageResponseStub;
export type IFrameMessageResponse = LedgerConnectionChangeActionResponse | LedgerMakeAppActionResponse | LedgerUpdateTransportActionResponse | LedgerUnlockActionResponse | LedgerSignTransactionActionResponse | LedgerSignPersonalMessageActionResponse | LedgerSignTypedDataActionResponse | LedgerGetAppNameAndVersionActionResponse | LedgerGetAppConfigurationActionResponse;
export type LedgerIframeBridgeOptions = {
bridgeUrl: string;
};
export declare class LedgerIframeBridge implements LedgerBridge {
#private;
iframe?: HTMLIFrameElement;
iframeLoaded: boolean;
eventListener?: (eventMessage: {
origin: string;
data: IFrameMessageResponse;
}) => void;
isDeviceConnected: boolean;
currentMessageId: number;
constructor(opts?: LedgerIframeBridgeOptions);
init(): Promise;
destroy(): Promise;
getOptions(): Promise;
setOptions(opts: LedgerIframeBridgeOptions): Promise;
attemptMakeApp(): Promise;
updateTransportMethod(transportType: string): Promise;
getPublicKey(params: GetPublicKeyParams): Promise;
deviceSignTransaction(params: LedgerSignTransactionParams): Promise;
deviceSignMessage(params: LedgerSignMessageParams): Promise;
deviceSignTypedData(params: LedgerSignTypedDataParams): Promise;
deviceSignDelegationAuthorization(_params: LedgerSignDelegationAuthorizationParams): Promise;
getAppNameAndVersion(): Promise;
getAppConfiguration(): Promise;
}
export {};
//# sourceMappingURL=ledger-iframe-bridge.d.cts.map