Hierarchy

  • PKPWalletConnect

Constructors

Properties

PREFIX: "[PKPWalletConnect]" = '[PKPWalletConnect]'
approveSession: ((params: {
    id: number;
    namespaces: Record<string, BaseNamespace>;
    relayProtocol?: string;
}) => Promise<Struct>) = ...

Type declaration

    • (params: {
          id: number;
          namespaces: Record<string, BaseNamespace>;
          relayProtocol?: string;
      }): Promise<Struct>
    • Approve a session proposal from a dapp

      Property

      The session ID

      Property

      The session namespace

      Property

      The relay protocol

      Returns

      • The session data

      Parameters

      • params: {
            id: number;
            namespaces: Record<string, BaseNamespace>;
            relayProtocol?: string;
        }
        • id: number
        • namespaces: Record<string, BaseNamespace>
        • Optional relayProtocol?: string

      Returns Promise<Struct>

client: IWeb3Wallet
debug: boolean = false
disconnectSession: ((params: {
    reason: ErrorResponse;
    topic: string;
}) => Promise<void>) = ...

Type declaration

    • (params: {
          reason: ErrorResponse;
          topic: string;
      }): Promise<void>
    • Disconnect a WalletConnect session

      Property

      The session topic

      Property

      The reason for disconnecting the session

      Returns

      Parameters

      • params: {
            reason: ErrorResponse;
            topic: string;
        }
        • reason: ErrorResponse
        • topic: string

      Returns Promise<void>

emitSessionEvent: ((params: {
    chainId: string;
    event: any;
    topic: string;
}) => Promise<void>) = ...

Type declaration

    • (params: {
          chainId: string;
          event: any;
          topic: string;
      }): Promise<void>
    • Emit session events

      Property

      The session topic

      Property

      The session event

      Returns

      Parameters

      • params: {
            chainId: string;
            event: any;
            topic: string;
        }
        • chainId: string
        • event: any
        • topic: string

      Returns Promise<void>

extendSession: ((params: {
    topic: string;
}) => Promise<void>) = ...

Type declaration

    • (params: {
          topic: string;
      }): Promise<void>
    • Extend WalletConnect session by updating session expiry

      Property

      The session topic

      Returns

      Parameters

      • params: {
            topic: string;
        }
        • topic: string

      Returns Promise<void>

getActiveSessions: (() => Record<string, Struct>) = ...

Type declaration

    • (): Record<string, Struct>
    • Get active sessions

      Returns

      Returns Record<string, Struct>

getPendingSessionProposals: (() => Record<number, Struct>) = ...

Type declaration

    • (): Record<number, Struct>
    • Get pending session proposals

      Returns

      Returns Record<number, Struct>

getPendingSessionRequests: (() => Struct[]) = ...

Type declaration

    • (): Struct[]
    • Get pending session requests

      Returns

      Returns Struct[]

orange: "\u001b[33m" = '\x1b[33m'
pair: ((params: {
    activatePairing?: boolean;
    uri: string;
}) => Promise<void>) = ...

Type declaration

    • (params: {
          activatePairing?: boolean;
          uri: string;
      }): Promise<void>
    • Pair with the given URI received from a dapp

      Parameters

      • params: {
            activatePairing?: boolean;
            uri: string;
        }
        • Optional activatePairing?: boolean
        • uri: string

      Returns Promise<void>

pkpClients: PKPClient[] = []
red: "\u001b[31m" = '\x1b[31m'
rejectSession: ((params: {
    id: number;
    reason: ErrorResponse;
}) => Promise<void>) = ...

Type declaration

    • (params: {
          id: number;
          reason: ErrorResponse;
      }): Promise<void>
    • Reject a session proposal from a dapp

      Property

      The session ID

      Property

      The reason for rejecting the session proposal

      Returns

      Parameters

      • params: {
            id: number;
            reason: ErrorResponse;
        }
        • id: number
        • reason: ErrorResponse

      Returns Promise<void>

reset: "\u001b[0m" = '\x1b[0m'
respondSessionRequest: ((params: {
    response: JsonRpcResponse<any>;
    topic: string;
}) => Promise<void>) = ...

Type declaration

    • (params: {
          response: JsonRpcResponse<any>;
          topic: string;
      }): Promise<void>
    • Respond to a session request received from a dapp

      Parameters

      • params: {
            response: JsonRpcResponse<any>;
            topic: string;
        }
        • response: JsonRpcResponse<any>
        • topic: string

      Returns Promise<void>

supportedChains: string[] = ...
updateSession: ((params: {
    namespaces: Namespaces;
    topic: string;
}) => Promise<void>) = ...

Type declaration

    • (params: {
          namespaces: Namespaces;
          topic: string;
      }): Promise<void>
    • Update WalletConnect session namespaces

      Property

      The session topic

      Property

      The session namespace

      Returns

      Parameters

      • params: {
            namespaces: Namespaces;
            topic: string;
        }
        • namespaces: Namespaces
        • topic: string

      Returns Promise<void>

Methods

  • Private

    Checks if the given WalletConnect client is initialized and returns it. If it's not initialized, throws an error.

    Returns

    • The initialized WalletConnect client instance

    Throws

    • If the WalletConnect client instance is not initialized

    Parameters

    • client: IWeb3Wallet

      The WalletConnect client instance to check for initialization

    Returns IWeb3Wallet

  • Logs an error message to the console and throws an Error with the same message.

    Returns

    • This function does not return a value since it always throws an Error.

    Parameters

    • message: string

      The error message to be logged and thrown.

    Returns never

  • Parse the session proposal received from a dapp, construct the session namespace, and approve the session proposal if the chain is supported.

    Returns

    • The session data if approved

    Parameters

    • proposal: {
          verifyContext: Context;
      } & Omit<BaseEventArgs<Struct>, "topic">

      The session proposal

    Returns Promise<void | Struct>

  • Approves a session request received from a dapp, processes the request using the wallet corresponding to the account in the request, and sends a response with the result or an error.

    Parameters

    • requestEvent: {
          verifyContext: Context;
      } & BaseEventArgs<{
          chainId: string;
          request: {
              method: string;
              params: any;
          };
      }>

      The session request

    Returns Promise<void>

  • Return list of addresses with namespace prefix given a chain

    Returns

    • List of addresses with namespace prefix

    Parameters

    • chain: string

      Chain in CAIP-2 format

    Returns Promise<string[]>

  • Parse and reject the session proposal

    Parameters

    • proposal: {
          verifyContext: Context;
      } & Omit<BaseEventArgs<Struct>, "topic">

      The session proposal

    • Optional reason: ErrorResponse

      The reason for rejecting the session proposal

    Returns Promise<void>

  • Reject a session request received from a dapp

    Parameters

    • requestEvent: {
          verifyContext: Context;
      } & BaseEventArgs<{
          chainId: string;
          request: {
              method: string;
              params: any;
          };
      }>

      The session request

    • Optional reason: ErrorResponse

      The reason for rejecting the session request

    Returns Promise<void>

Generated using TypeDoc