Summary

The Wallet SDK class

Since

0.2.0

Constructors

Properties

config: WalletSDKConfig = ...
provider: Provider

Summary

The provider instance

storage: SdkStorage = ...

Summary

SdkStorage class instance

user: null | User = null

Summary

The Grindery Wallet user

Methods

  • Returns Promise<string[]>

    The array of ethereum addresses

    Summary

    Initiate connection to the Grindery Wallet

    Since

    0.1.0

  • Returns Promise<boolean>

    True if wallet is disconnected

    Summary

    Disconnects Grindery Wallet

    Since

    0.1.0

  • Returns string

    Returns chain id in CAIP-2 format

    Summary

    Gets currently connected chain

    Since

    0.3.0

  • Parameters

    • userId: string

      Telegram user ID

    Returns Promise<string>

    Grindery Wallet address

    Summary

    Exchange Telegram user ID to Grindery Wallet address

    Since

    0.4.0

  • Private

    Parameters

    Returns void

    Summary

    Handles the pairing request, by opening the Grindery Wallet

  • Returns boolean

    True if the provider is connected to the server.

    Summary

    Checks if the provider is connected to the server

    Example

    const isConnected = window.Grindery.WalletSDK.isConnected();
    
  • Returns boolean

    True if the provider is connected to the server and the Grindery Wallet.

    Summary

    Checks if the provider is connected to the server and the Grindery Wallet

  • Parameters

    • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

      Event name

    • callback: Function

      Callback function

    Returns WalletSDK

    The instance of the class itself

    Summary

    Adds a listener to the event

  • Parameters

    • event: "accountsChanged" | "pair" | "connect" | "disconnect" | "chainChanged" | "message"

      Event name

    • callback: Function

      Callback function

    Returns WalletSDK

    The instance of the class itself

    Summary

    Removes a listener from the event

  • Parameters

    • params: {
          data?: string;
          to: string;
          value?: string;
      }

      The transaction parameters

      • Optional data?: string

        The data to send

      • to: string

        The recipient address

      • Optional value?: string

        The amount to send in wei

    Returns Promise<string>

    Transaction hash string

    Summary

    Sends a transaction request to the Grindery Wallet

    Since

    0.1.0

  • Parameters

    • appId: string

      The application ID

    Returns void

    Summary

    Sets the application ID

    Since

    0.5.1

  • Parameters

    • message: string

      The message to sign

    Returns Promise<string>

    Signature string

    Summary

    Sends a personal signature request to the Grindery Wallet

    Since

    0.1.0

  • Parameters

    • chainId: string

      Chain id in CAIP-2 format

    Returns Promise<null>

    Returns null on success

    Summary

    Requests the Grindery Wallet to switch the chain

    Since

    0.3.0

  • Private

    Parameters

    • name: "appOpened" | "walletConnected" | "walletDisconnected" | "walletAddressRequested"
    • Optional data: Record<string, unknown>

    Returns Promise<void>

    Summary

    Tracks client side event

    Since

    0.4.2