import { SEND_CRYPTO_SUPPORTED_VERSION } from './consts'; declare type TAsset = string; declare type TEthAddress = string; declare type TSwapAmount = string; declare type THostLogoUrl = string; declare type THostApiKey = string; declare type THostAppName = string; declare type TURL = string; declare type TPathname = string; declare type TDateString = string; declare type TFiatCurrency = string; declare type TFiatValue = string; declare type TAddress = string; declare type TEmailAddress = string; declare type TCryptoAmount = string; declare type TAssetExchangeRate = number; declare type TFinalTxHash = string; declare type TActionID = string; declare type TNewActionStatus = string; declare type TActionTimestamp = string; declare type TActionDetails = string; declare type TWebhookStatusUrl = string; declare type TFinalUrl = string; declare type TContainerNode = HTMLElement; declare type TFlow = 'ONRAMP' | 'OFFRAMP'; export declare enum PaymentMethodName { MANUAL_BANK_TRANSFER = "MANUAL_BANK_TRANSFER", AUTO_BANK_TRANSFER = "AUTO_BANK_TRANSFER", CARD_PAYMENT = "CARD_PAYMENT", APPLE_PAY = "APPLE_PAY" } export declare enum PaymentMethodType { SEPA = "SEPA", CARD = "CARD", APPLEPAY = "APPLEPAY", GOOGLEPAY = "GOOGLEPAY", PISP = "PISP", SOFORT = "SOFORT", PIX = "PIX" } export declare enum PurchaseStatus { INITIALIZED = "INITIALIZED", PAYMENT_STARTED = "PAYMENT_STARTED", PAYMENT_IN_PROGRESS = "PAYMENT_IN_PROGRESS", PAYMENT_FAILED = "PAYMENT_FAILED", PAYMENT_EXECUTED = "PAYMENT_EXECUTED", FIAT_RECEIVED = "FIAT_RECEIVED", FIAT_SENT = "FIAT_SENT", EXPIRED = "EXPIRED", CANCELLED = "CANCELLED", RELEASING = "RELEASING", RELEASED = "RELEASED" } export declare type TPurchaseExternalId = string; interface IHostConfigBase { swapAsset?: TAsset; offrampAsset?: TAsset; swapAmount?: TSwapAmount; fiatValue?: TFiatValue; fiatCurrency?: TFiatCurrency; userAddress?: TEthAddress; userEmailAddress?: TEmailAddress; hostLogoUrl?: THostLogoUrl; hostAppName?: THostAppName; pathname?: TPathname; variant?: AllWidgetVariants; webhookStatusUrl?: TWebhookStatusUrl; finalUrl?: TFinalUrl; containerNode?: TContainerNode; selectedCountryCode?: string; defaultAsset?: TAsset; defaultFlow?: TFlow; enabledFlows?: TFlow[]; offrampWebhookV3Url?: TWebhookStatusUrl; useSendCryptoCallback?: boolean; paymentMethodType?: PaymentMethodType; hideExitButton?: boolean; closeable?: boolean; credentialless?: boolean; } interface IHostConfigSignedUrlBased extends IHostConfigBase { url: TURL; hostApiKey?: THostApiKey; } interface IHostConfigTraditional extends IHostConfigBase { url?: TURL; hostApiKey: THostApiKey; } export declare type IHostConfig = IHostConfigSignedUrlBased | IHostConfigTraditional; export interface IHostConfigWithSdkParams extends Omit { sdkType: 'WEB'; sdkVersion: string; widgetInstanceId: string; variant: AllWidgetVariants; useSendCryptoCallbackVersion?: typeof SEND_CRYPTO_SUPPORTED_VERSION; } export interface IAssetInfo { address: string | null; symbol: string; type: string; name: string; decimals: number; } export interface IPurchase { id: TPurchaseExternalId; endTime: TDateString | null; asset: IAssetInfo; receiverAddress: TAddress; cryptoAmount: TCryptoAmount; fiatCurrency: TFiatCurrency; fiatValue: TFiatValue; assetExchangeRate: TAssetExchangeRate; baseRampFee: TFiatValue; networkFee: TFiatValue; appliedFee: TFiatValue; paymentMethodType: PaymentMethodName; finalTxHash?: TFinalTxHash; createdAt: TDateString; updatedAt: TDateString; status: PurchaseStatus; } export interface AssetInfo { address: string | null; symbol: string; chain: string; type: string; name: string; decimals: number; } export interface IOfframpSale { id: string; createdAt: string; crypto: { amount: string; assetInfo: AssetInfo; }; fiat: { amount: number; currencySymbol: string; }; } export interface IAction { id: TActionID; newStatus: TNewActionStatus; timestamp: TActionTimestamp; details: TActionDetails; } export declare enum EventSeverity { VERBOSE = "VERBOSE", DEBUG = "DEBUG", INFO = "INFO", WARNING = "WARNING", ERROR = "ERROR", CRITICAL = "CRITICAL" } export interface IConfigError { fieldName: string; description: string; exampleValue?: string; severity: EventSeverity; } export interface IWidgetEvent { type: string; payload: any | null; internal?: boolean; } export declare enum WidgetEventTypes { WIDGET_CLOSE = "WIDGET_CLOSE", WIDGET_CONFIG_DONE = "WIDGET_CONFIG_DONE", WIDGET_CONFIG_FAILED = "WIDGET_CONFIG_FAILED", PURCHASE_CREATED = "PURCHASE_CREATED", OFFRAMP_SALE_CREATED = "OFFRAMP_SALE_CREATED" } export declare enum InternalEventTypes { APP_VERSION = "APP_VERSION", WIDGET_CLOSE_REQUEST = "WIDGET_CLOSE_REQUEST", WIDGET_CLOSE_REQUEST_CANCELLED = "WIDGET_CLOSE_REQUEST_CANCELLED", WIDGET_CLOSE_REQUEST_CONFIRMED = "WIDGET_CLOSE_REQUEST_CONFIRMED", REQUEST_CRYPTO_ACCOUNT = "REQUEST_CRYPTO_ACCOUNT", SEND_CRYPTO = "SEND_CRYPTO" } export declare type TAllEventTypes = WidgetEventTypes | InternalEventTypes; export interface IWidgetCloseEvent extends IWidgetEvent { type: WidgetEventTypes.WIDGET_CLOSE; payload: null; widgetInstanceId: string; internal?: false; } export interface IPurchaseCreatedEvent extends IWidgetEvent { type: WidgetEventTypes.PURCHASE_CREATED; payload: { purchase: IPurchase; purchaseViewToken: string; apiUrl: string; }; widgetInstanceId: string; internal?: false; } export interface IOfframpSaleCreatedEvent extends IWidgetEvent { type: WidgetEventTypes.OFFRAMP_SALE_CREATED; payload: { sale: IOfframpSale; saleViewToken: string; apiUrl: string; }; widgetInstanceId: string; internal?: false; } export interface IWidgetConfigDoneEvent extends IWidgetEvent { type: WidgetEventTypes.WIDGET_CONFIG_DONE; payload: null; widgetInstanceId: string; internal?: false; } export interface IWidgetConfigFailedEvent extends IWidgetEvent { type: WidgetEventTypes.WIDGET_CONFIG_FAILED; payload: null; widgetInstanceId: string; internal?: false; } export interface IWidgetCloseRequestEvent extends IWidgetEvent { type: InternalEventTypes.WIDGET_CLOSE_REQUEST; payload: null; widgetInstanceId?: string; internal: boolean; } export interface IRequestCryptoAccountEvent extends IWidgetEvent { type: InternalEventTypes.REQUEST_CRYPTO_ACCOUNT; payload: { type: string; assetSymbol: string; }; widgetInstanceId?: string; } export interface ISendCryptoEvent extends IWidgetEvent { eventVersion: typeof SEND_CRYPTO_SUPPORTED_VERSION; type: InternalEventTypes.SEND_CRYPTO; payload: { assetInfo: AssetInfo; amount: string; address: string; }; widgetInstanceId?: string; } export interface IWidgetCloseRequestCancelledEvent extends IWidgetEvent { type: InternalEventTypes.WIDGET_CLOSE_REQUEST_CANCELLED; payload: null; internal: true; } export interface IWidgetCloseRequestConfirmedEvent extends IWidgetEvent { type: InternalEventTypes.WIDGET_CLOSE_REQUEST_CONFIRMED; payload: null; internal: true; } export interface IAppVersionEvent extends IWidgetEvent { type: InternalEventTypes.APP_VERSION; payload: { version: `${number}.${number}`; }; widgetInstanceId: string; internal: true; } export declare type TWidgetEvents = IWidgetCloseEvent | IWidgetConfigDoneEvent | IWidgetConfigFailedEvent | IPurchaseCreatedEvent | IOfframpSaleCreatedEvent; export declare type TInternalEvents = IWidgetCloseRequestEvent | IWidgetCloseRequestCancelledEvent | IWidgetCloseRequestConfirmedEvent | IRequestCryptoAccountEvent | ISendCryptoEvent | IAppVersionEvent; export declare enum InternalSdkEventTypes { REQUEST_CRYPTO_ACCOUNT_RESULT = "REQUEST_CRYPTO_ACCOUNT_RESULT", SEND_CRYPTO_RESULT = "SEND_CRYPTO_RESULT" } export interface IRequestCryptoAccountResultEvent extends IWidgetEvent { type: InternalSdkEventTypes.REQUEST_CRYPTO_ACCOUNT_RESULT; payload: IOnRequestCryptoAccountResult | { error: string | undefined; }; widgetInstanceId?: string; } export interface ISendCryptoResultEvent extends IWidgetEvent { eventVersion: typeof SEND_CRYPTO_SUPPORTED_VERSION; type: InternalSdkEventTypes.SEND_CRYPTO_RESULT; payload: IOnSendCryptoResult | { error: string | undefined; }; widgetInstanceId?: string; } export declare type TSdkEvents = IRequestCryptoAccountResultEvent | ISendCryptoResultEvent; export declare type TAllEvents = TWidgetEvents | TInternalEvents; export declare type WidgetVariantTypes = 'desktop' | 'mobile' | 'hosted-desktop' | 'hosted-mobile' | 'webview-desktop' | 'webview-mobile'; export declare type SyntheticWidgetVariants = 'hosted-auto' | 'auto' | 'embedded-desktop' | 'embedded-mobile'; export declare type AllWidgetVariants = WidgetVariantTypes | SyntheticWidgetVariants; export declare type TUnsubscribeToken = string; export declare type TEventListenerDict = { [EventType in TAllEvents['type']]: IEventListener[]; }; export interface IEventListener { internal: boolean; callback(evt: TAllEvents): any; } export interface IOnRequestCryptoAccountResult { address: string; type?: string; name?: string; assetSymbol?: string; } export interface IOnSendCryptoResult { txHash: string; } export declare type TOnRequestCryptoAccountCallback = (type: string, assetSymbol: string) => Promise; export declare type TOnSendCryptoCallback = (assetInfo: AssetInfo, amount: string, address: string) => Promise; export {};