import type { Provider, EventListener } from '@canton-network/core-splice-provider'; import type { RequestArgs } from '@canton-network/core-types'; import type { RpcTypes as DappRpcTypes } from '@canton-network/core-wallet-dapp-rpc-client'; import type { ProviderAdapter, WalletInfo } from '@canton-network/core-wallet-discovery'; import type { ProviderId, ProviderType } from '@canton-network/core-wallet-dapp-rpc-client'; /** * The timestamp is a UTC string representing the time in ISO 8601 format. */ export type Timestamp = string; /** * This interface represents the SIWX message metadata. * Here must contain the main data related to the app. */ export interface Metadata { requestId?: string; domain: string; uri: string; version: string; nonce?: string; notBefore?: Timestamp; statement?: string; resources?: string[]; } /** * This interface represents the SIWX message identifier. * Here must contain the request id and the timestamps. */ export interface Identifier { requestId?: string; issuedAt?: Timestamp; expirationTime?: Timestamp; } export interface SIWXMessageParams extends Metadata, Identifier { } export interface RequestSIWXParams extends SIWXMessageParams { account: string; } export interface SignInWithCantonResult { requestId: string | undefined; nonce: string; account: string; chainId: string; message: string; publicKey: string; signature: string; error?: SignInWithCantonError; } export interface SignInWithCantonError { message: string; code: number; } export interface WalletConnectAdapterConfig { projectId: string; chainId?: string; metadata?: { name: string; description: string; url: string; icons: string[]; }; /** Whether to trigger a canton_signMessage request after the session is established. */ signInWithCanton?: SIWXMessageParams; /** Called with the pairing URI so the dApp can display or forward it. */ onUri?: (uri: string) => void; onSignInWithCanton?: (result: SignInWithCantonResult) => void; } /** * Single-class WalletConnect adapter that implements both ProviderAdapter * (for discovery/wallet-picker) and Provider (for RPC calls). * * Calls signClient.request() directly with `canton_` prefixed methods. * Events arriving via session_event are buffered until a listener attaches. */ export declare class WalletConnectAdapter implements ProviderAdapter, Provider { readonly providerId: ProviderId; readonly name = "WalletConnect"; readonly type: ProviderType; readonly icon: string | undefined; private readonly projectId; private readonly chainId; private readonly metadata; private readonly onUri; private readonly onSignInWithCanton; private readonly signInWithCanton; private signClient; private session; private initPromise; private listeners; private eventBuffer; static create(config: WalletConnectAdapterConfig): WalletConnectAdapter; constructor(config: WalletConnectAdapterConfig); getInfo(): WalletInfo; detect(): Promise; provider(): Provider; teardown(): void; restore(): Promise | null>; request(args: RequestArgs): Promise; on(event: string, listener: EventListener): this; emit(event: string, ...args: E[]): boolean; removeListener(event: string, listenerToRemove: EventListener): this; /** Send a request through signClient, prefixing the method with `canton_`. */ private walletConnectRequest; private emitConnected; private emitDisconnected; private initSignClient; /** Wire up session_event forwarding for the current session. */ private setupSessionEvents; private establishSession; private showUriInPopup; } //# sourceMappingURL=walletconnect-adapter.d.ts.map