Class KeyringSnapControllerClient

A KeyringClient that allows the communication with a snap through the SnapController.

Hierarchy

  • KeyringClient
    • KeyringSnapControllerClient

Constructors

  • Create a new instance of KeyringSnapControllerClient.

    The handlerType argument has a hard-coded default string value instead of a HandlerType value to prevent the @metamask/snaps-utils module from being required at runtime.

    Parameters

    • args: { controller: SnapController; handler?: HandlerType; origin?: string; snapId?: SnapId }

      Constructor arguments.

      • controller: SnapController

        The SnapController instance to use.

      • Optional handler?: HandlerType

        The handler type (default: 'onKeyringRequest').

      • Optional origin?: string

        The sender's origin (default: 'metamask').

      • Optional snapId?: SnapId

        The ID of the snap to use (default: 'undefined').

    Returns KeyringSnapControllerClient

Methods

  • Parameters

    • id: string
    • Optional data: Record<string, Json>

    Returns Promise<void>

  • Parameters

    • Optional options: Record<string, Json>

    Returns Promise<{ address: string; id: string; methods: string[]; options: Record<string, Json>; type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" }>

  • Parameters

    • id: string

    Returns Promise<void>

  • Parameters

    • id: string

    Returns Promise<Record<string, Json>>

  • Parameters

    • id: string
    • chains: string[]

    Returns Promise<string[]>

  • Parameters

    • id: string

    Returns Promise<{ address: string; id: string; methods: string[]; options: Record<string, Json>; type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" }>

  • Parameters

    • id: string
    • assets: string[]

    Returns Promise<Record<string, { amount: string; unit: string }>>

  • Get the SnapController instance used by this client.

    Returns

    The SnapController instance used by this client.

    Returns SnapController

  • Parameters

    • id: string

    Returns Promise<{ account: string; id: string; request: { method: string; params?: Json[] | Record<string, Json> }; scope: string }>

  • Returns Promise<{ address: string; id: string; methods: string[]; options: Record<string, Json>; type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" }[]>

  • Returns Promise<{ account: string; id: string; request: { method: string; params?: Json[] | Record<string, Json> }; scope: string }[]>

  • Parameters

    • id: string

    Returns Promise<void>

  • Parameters

    • request: { account: string; id: string; request: { method: string; params?: Json[] | Record<string, Json> }; scope: string }
      • account: string
      • id: string
      • request: { method: string; params?: Json[] | Record<string, Json> }
        • method: string
        • Optional params?: Json[] | Record<string, Json>
      • scope: string

    Returns Promise<{ pending: true; redirect?: { message?: string; url?: string } } | { pending: false; result: Json }>

  • Parameters

    • account: { address: string; id: string; methods: string[]; options: Record<string, Json>; type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh" }
      • address: string
      • id: string
      • methods: string[]
      • options: Record<string, Json>
      • type: "eip155:eoa" | "eip155:erc4337" | "bip122:p2wpkh"

    Returns Promise<void>