/// import { EventEmitter } from "events"; import { EIP1193Parameters } from "viem"; import { Eip1193Provider, RoninWaypointRequestSchema } from "../common/eip1193"; import { BaseAuthorizeOpts } from "./auth"; import { WaypointConfig } from "./common/config"; export type WaypointProviderOpts = BaseAuthorizeOpts & WaypointConfig & { chainId: number; }; /** * A JavaScript Ethereum Provider API for consistency across clients and applications. * * This provider is designed to easily integrate with Ronin Waypoint. * * Use `create` function to create a new instance." import { EventEmitter } from "events" import { A, ChainDisconnectedError, Client, createClient, EIP1193Parameters, http, ProviderDisconnectedError, toHex, UnauthorizedProviderError } from "viem * * @example * import { WaypointProvider } from "@sky-mavis/waypoint" * * const idWalletProvider = WaypointProvider.create({ * clientId: "YOUR_CLIENT_ID", * chainId: ronin.chainId, * }) */ export declare class WaypointProvider extends EventEmitter implements Eip1193Provider { private readonly clientId; private readonly waypointOrigin; private readonly redirectUrl; private readonly scopes; readonly chainId: number; private address?; private readonly viemClient; private readonly communicateHelper; readonly config: WaypointConfig; protected constructor(options: WaypointProviderOpts); private createViemClient; private addDefaultScopes; /** * Creates a new WaypointProvider instance. * * @param options Options for WaypointProvider. * * @returns WaypointProvider instance. * * @example * import { WaypointProvider } from "@sky-mavis/waypoint" * * const idWalletProvider = WaypointProvider.create({ * clientId: "YOUR_CLIENT_ID", * chainId: ronin.chainId, * }) */ static create: (options: WaypointProviderOpts) => WaypointProvider; private getIdAddress; private getIdAddressOrConnect; /** * Connects to Ronin Waypoint provider and retrieves authorization data & user wallet address. * * @returns The access token and address. */ connect: () => Promise<{ token: string; address: `0x${string}`; }>; createKeylessWallet: () => Promise<{ token: string; address: `0x${string}`; }>; private handleAuthData; /** * Disconnect from Ronin Waypoint provider and clear the cached address in localStorage. */ disconnect: () => void; /** * A JavaScript Ethereum Provider API for consistency across clients and applications. * * Makes an Ethereum RPC method call. * * https://eips.ethereum.org/EIPS/eip-1193 */ request: (args: EIP1193Parameters) => Promise; }