import { LoginRedirectWalletType, QubicSignInProvider } from '@qubic-connect/redirect'; import { QubicConnectConfig, WalletUser, BindTicketResult, Credential } from './types/QubicConnectConfig'; import { ExtendedExternalProvider, ExtendedExternalProviderMethod } from './types/ExtendedExternalProvider'; import { SdkRequestGraphql } from './utils/graphql'; import { SdkFetch } from './utils/sdkFetch'; import { AssetBuyInput, AssetBuyOptions, GiftRedeemInput, GiftRedeemOptions } from './types/Asset'; import { AssetBuyResponse, GiftRedeemResponse } from './api/assets'; export declare class QubicConnect { private readonly config; private authRedirectUrl; provider: ExtendedExternalProvider | null; address: string | null; accessToken: string | null; expiredAt: number | null; private eventEmitter; private user; private static checkProviderOptions; fetch: SdkFetch; requestGraphql: SdkRequestGraphql; marketRequestGraphql: SdkRequestGraphql; private readonly shouldAutoLoginInWalletIab; private isUserReady; constructor(config: QubicConnectConfig); private static persistUser; private hydrateUser; private handleUserPurge; private handleLogin; private handleLogout; private static ifTokenExpired; private checkTokenExpiredIntervalId; private startIntervalToCheckTokenExpired; private stopIntervalToCheckTokenExpired; private renewToken; private handleAccountsChanged; loginWithWallet(method: Exclude, qubicSignInProvider?: QubicSignInProvider): Promise; logout(): Promise; /** No any web3 provider will be used, only for get access token */ /** * 1. loginWithRedirect() will go to auth helper url with `redirectUrl`, `dataString` * 2. auth helper url shows Qubic wallet and other wallets * a. Qubic wallet: redirect to Qubic wallet, after user sign in success, get `ticket` from backend * b. Other wallet: sign `dataString` and get `signature` * 3. then go to `redirectUrl` with results which includes signature or ticket * 4. handleRedirectResult() uses results to get creator access token * 5. now user can use fetch() or requestGraphql() to call api */ loginWithRedirect(options?: { walletType: LoginRedirectWalletType; qubicSignInProvider?: QubicSignInProvider; }): void; bindWithRedirect(options?: { walletType: LoginRedirectWalletType; qubicSignInProvider?: QubicSignInProvider; }): Promise; private cachedRedirectResult?; private cachedRedirectError?; onAuthStateChanged(callback: (result: WalletUser | null, error?: Error) => void): () => void; private cachedBindTicketResult?; private cachedBindTicketError?; onBindTicketResult(callback: (result: BindTicketResult | null, error?: Error) => void): () => void; private static getRedirectResultFromUrlAndClearUrl; private hasRedirectResult; private handleRedirectResult; private pendingGetRedirectResultDeferred; getRedirectResult(): Promise; getCurrentUser(): WalletUser | null; loginWithCredential(credential: Credential): Promise; buyAssetAndCreateCheckout(assetBuyInput: AssetBuyInput, options?: AssetBuyOptions): Promise; giftRedeem(giftRedeemInput: GiftRedeemInput, options?: GiftRedeemOptions): Promise; /** * Generate a url to Qubic wallet collectible list * @deprecated please use getUserQubicWalletUrl * @param {string} walletUrl is only for developing purpose, not sdk maintainer don't have to know * @returns {string} url string */ getUserQubicWalletCollectibleUrl(walletUrl?: string): string | null; /** * Generate a url to Qubic Wallet specific path * @param {Object} [option] - * * option.walletUrl - optional: only for developing sdk purpose * * option.nextPath - optional: target path ex: `/home` * @returns {string} url string */ getUserQubicWalletUrl(option?: { walletUrl?: string; nextPath?: string; }): string | null; /** * Generate a url to Qubic Pass specific path * @param {Object} [option] - * * option.passUrl - optional: only for developing sdk purpose * * option.nextPath - optional: target path ex: `/home` * @returns {string} url string */ getUserQubicPassUrl(option?: { passUrl?: string; nextPath?: string; }): string | null; /** * @deprecated use getUserQubicPassUrl */ getUserPassUrl(option?: { passUrl?: string; nextPath?: string; }): string | null; }