/// import type { XummSdk, XummSdkJwt, xAppOttData, Payload, JwtUserdata, Storage, Push } from "xumm-sdk"; import type { XummPkceEvent, ResolvedFlow, XummProfile } from "xumm-oauth2-pkce"; import type { xApp, xAppEvent } from "xumm-xapp-sdk"; import { EventEmitter } from "events"; export interface UniversalSdkEvent { logout: () => void; ready: () => void; retrieving: () => void; } /** * Development? * npm run watch (tsc in watch mode) * npm run browserify-watch (watch, browserify tsc output) * npm run serve (webserver, :3001) * npm run dev (watch, nodemon dist/samples/index.js) * ngrok start dev (local :3001 to https:// dev URL) * > https://.../sample/ */ declare enum Runtimes { cli = "cli", browser = "browser", xapp = "xapp" } type Runtime = Record; export declare interface Xumm { on(event: U, listener: UniversalSdkEvent[U]): this; on(event: U, listener: xAppEvent[U]): this; on(event: U, listener: XummPkceEvent[U]): this; off(event: U, listener: UniversalSdkEvent[U]): this; off(event: U, listener: xAppEvent[U]): this; off(event: U, listener: XummPkceEvent[U]): this; } /** * The Promisified type takes an entire class and expects all methods * to return a Promise of their method's native return values */ type Promisified = { [K in keyof T]: T[K] extends (...args: infer A) => infer R ? (...args: A) => Promise : T[K]; }; interface Environment { ott?: Promise; jwt?: Promise<{ client_id: string; scope?: string; state?: string; aud: string; sub: string; email?: string; app_uuidv4: string; app_name: string; payload_uuidv4?: string; usertoken_uuidv4?: string; network_type?: string; network_endpoint?: string; network_id?: number; iat: number; exp: number; iss: string; usr?: string; net?: string; [key: string]: any; } | undefined>; openid?: Promise<{ sub: string; email: string; picture: string; account: string; name: string; domain?: string; blocked: boolean; source?: string; kycApproved: boolean; proSubscription: boolean; networkType: string; networkEndpoint: string; networkId?: number; profile?: XummProfile; [key: string]: any; } | undefined>; bearer?: Promise; retrieving: Promise; ready: Promise; success: Promise; retrieved: Promise; } declare class UnifiedUserData { account: Promise; picture: Promise; name: Promise; domain: Promise; source: Promise; networkType: Promise; networkEndpoint: Promise; networkId: Promise; blocked: Promise; kycApproved: Promise; proSubscription: Promise; profile: Promise; token: Promise; } /** * This is where the magic happens */ export declare class Xumm extends EventEmitter { private instance; private jwtCredential; runtime: Runtime; state: { account: string; signedIn: boolean; }; user: UnifiedUserData; environment: Environment; payload?: Promisified; xapp?: xApp; userstore?: Promisified; backendstore?: Promisified; helpers?: Promisified>; push?: Promisified; private apiKeyOrJwt; private apiSecretOrOtt?; constructor(apiKeyOrJwt: string, apiSecretOrOtt?: string); private initialize; /** * PKCE */ authorize(): Promise; /** * TODO: CHECK IF EVENTS ARE NOT REGISTERED AND FIRING TWICE */ private handlePkceEvents; logout(): Promise; /** * SDK */ ping(): Promise | undefined>; } export {};