Publicapi

The WalletClient has to be used in the wallet. It handles all the logic related to connecting to beacon-compatible dapps and handling/responding to requests.

Hierarchy

Constructors

Properties

_beaconId: ExposedPromise<string, unknown>

The beaconId is a public key that is used to identify one specific application (dapp or wallet). This is used inside a message to specify the sender, for example.

_isConnected: ExposedPromise<boolean, unknown>

Returns whether or not the transport is connected

_keyPair: ExposedPromise<KeyPair, unknown>

The local keypair that is used for the communication encryption

_transport: ExposedPromise<Transport<any, any, any>, unknown>
accountManager: AccountManager
appMetadataManager: any
appUrl?: string

The URL of the dApp.

disconnect: any
getPeerInfo: any
handleResponse: ((_event, connectionInfo) => void)

Type declaration

iconUrl?: string

The URL of the dApp Icon. This can be used to display the icon of the dApp on in the wallet

matrixNodes: NodeDistributions
name: string

The name of the client

pendingRequests: any

This array stores pending requests, meaning requests we received and have not yet handled / sent a response.

permissionManager: any
rateLimit: number

How many requests can be sent after another

rateLimitWindowInSeconds: number

The time window in seconds in which the "rateLimit" is checked

removePermissionsForPeers: any
requestCounter: number[]

Stores the times when requests have been made to determine if the rate limit has been reached

respondToMessage: any

An internal method to send a BeaconMessage to the DApp

Param

Send a message back to the DApp

sendAcknowledgeResponse: any

Send an acknowledge message back to the sender

Param

The message that was received

storage: Storage

Accessors

  • get beaconId(): Promise<string>
  • Returns Promise<string>

  • get connectionStatus(): TransportStatus
  • Returns the connection status of the Client

    Returns TransportStatus

  • get isConnected(): Promise<boolean>
  • Returns Promise<boolean>

  • get keyPair(): Promise<KeyPair>
  • Returns Promise<KeyPair>

  • get ready(): Promise<void>
  • Returns whether or not the transaport is ready

    Returns Promise<void>

  • get transport(): Promise<Transport<any, any, any>>
  • Returns Promise<Transport<any, any, any>>

Methods

  • The method will attempt to initiate a connection using the active transport.

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Add a new peer to the known peers

    Parameters

    • peer: PeerInfo

      The new peer to add

    • Optional sendPairingResponse: boolean

    Returns Promise<void>

  • Add a new request (current timestamp) to the pending requests, remove old ones and check if we are above the limit

    Returns Promise<boolean>

  • Returns Promise<void>

  • This method initiates a connection to the P2P network and registers a callback that will be called whenever a message is received.

    Parameters

    • newMessageCallback: ((message, connectionContext) => void)

      The callback that will be invoked for every message the transport receives.

    Returns Promise<void>

  • This resets the SDK. After using this method, this instance is no longer usable. You will have to instanciate a new client.

    Returns Promise<void>

  • Return the account by ID

    Parameters

    • accountIdentifier: string

      The ID of an account

    Returns Promise<undefined | AccountInfo>

  • Return all locally known accounts

    Returns Promise<AccountInfo[]>

  • Parameters

    • senderId: string

    Returns Promise<undefined | AppMetadata>

  • Returns Promise<AppMetadata[]>

  • Return all known peers

    Returns Promise<PeerInfo[]>

  • Parameters

    • accountIdentifier: string

    Returns Promise<undefined | PermissionInfo>

  • Returns Promise<PermissionInfo[]>

  • Parameters

    • backendUrl: string
    • accountPublicKey: string
    • Optional oracleUrl: string

    Returns Promise<{
        challenge: {
            id: string;
            timestamp: string;
        };
        payloadToSign: string;
    }>

  • This method initializes the client. It will check if the connection should be established to a browser extension or if the P2P transport should be used.

    Returns Promise<TransportType>

  • Parameters

    • challenge: {
          id: string;
          timestamp: string;
      }
      • id: string
      • timestamp: string
    • signature: string
    • backendUrl: string
    • accountPublicKey: string
    • protocolIdentifier: string
    • deviceId: string
    • Optional oracleUrl: string

    Returns Promise<PushToken>

  • Remove the account by ID

    Parameters

    • accountIdentifier: string

      The ID of an account

    Returns Promise<void>

  • Remove all locally stored accounts

    Returns Promise<void>

  • Returns Promise<void>

  • Parameters

    • Optional sendDisconnectToPeers: boolean

    Returns Promise<void>

  • Returns Promise<void>

  • Parameters

    • senderId: string

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Parameters

    • accountIdentifier: string

    Returns Promise<void>

  • This method sends a response for a specific request back to the DApp

    Parameters

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • A "setter" for when the transport needs to be changed.

    Parameters

    • Optional transport: Transport<any, any, any>

    Returns Promise<void>

Generated using TypeDoc