Documentation
    Preparing search index...

    Class ClientAbstract

    This abstract class handles the a big part of the logic that is shared between the dapp and wallet client. For example, it selects and manages the transport and accounts.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _beaconId: ExposedPromise<string>

    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.

    _keyPair: ExposedPromise<KeyPair>

    The local keypair that is used for the communication encryption

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

    The URL of the dApp.

    handleResponse: (
        _event: BeaconRequestMessage | BeaconMessageWrapper<BeaconBaseMessage>,
        connectionInfo: ConnectionContext,
    ) => void
    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

    rateLimit: number

    How many requests can be sent after another

    rateLimitWindowInSeconds: number

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

    requestCounter: number[]

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

    storage: Storage

    Accessors

    • get beaconId(): Promise<string>

      Returns Promise<string>

    • get connectionStatus(): TransportStatus

      Returns the connection status of the Client

      Returns TransportStatus

    • 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

    • Parameters

      Returns Promise<void>

    • Add a new peer to the known peers

      Parameters

      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 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[]>

    • Returns the metadata of this DApp

      Returns Promise<AppMetadata>

    • Return all known peers

      Returns Promise<PeerInfo[]>

    • 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.

      Parameters

      • transport: Transport<any>

        A transport that can be provided by the user

      Returns Promise<TransportType>

    • This method initializes the SDK by setting some values in the storage and generating a keypair.

      Returns Promise<void>

    • Remove the account by ID

      Parameters

      • accountIdentifier: string

        The ID of an account

      Returns Promise<void>

    • Remove all locally stored accounts

      Returns Promise<void>

    • Parameters

      Returns Promise<void>

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

      Parameters

      Returns Promise<void>