Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Index

Constructors

constructor

Properties

Private _activeAccount

_activeAccount: ExposedPromise<undefined | AccountInfo, unknown> = ...

The currently active account. For all requests that are associated to a specific request (operation request, signing request), the active account is used to determine the network and destination wallet

Private _activePeer

_activePeer: ExposedPromise<undefined | ExtendedPostMessagePairingResponse | ExtendedP2PPairingResponse, unknown> = ...

The currently active peer. This is used to address a peer in case the active account is not set. (Eg. for permission requests)

Protected _beaconId

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

Private _initPromise

_initPromise: undefined | Promise<TransportType>

Protected _keyPair

_keyPair: ExposedPromise<KeyPair, unknown> = ...

The local keypair that is used for the communication encryption

Protected _transport

_transport: ExposedPromise<Transport<any, any, any>, unknown> = ...

Protected Readonly accountManager

accountManager: AccountManager

Private Readonly activeAccountLoaded

activeAccountLoaded: Promise<void>

Private Readonly appMetadataManager

appMetadataManager: AppMetadataManager

Optional Readonly appUrl

appUrl: string

The URL of the dApp.

Readonly blockExplorer

blockExplorer: BlockExplorer

The block explorer used by the SDK

Private Optional Readonly disclaimerText

disclaimerText: string

Protected Readonly events

Protected handleResponse

handleResponse: (_event: BeaconRequestMessage, connectionInfo: ConnectionContext) => void

Type declaration

Optional Readonly iconUrl

iconUrl: string

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

Protected Readonly matrixNodes

matrixNodes: string[]

Readonly name

name: string

The name of the client

Private Readonly openRequests

openRequests: Map<string, ExposedPromise<{ connectionInfo: ConnectionContext; message: BeaconMessage }, ErrorResponse>> = ...

A map of requests that are currently "open", meaning we have sent them to a wallet and are still awaiting a response.

Protected p2pTransport

p2pTransport: undefined | DappP2PTransport

Protected postMessageTransport

postMessageTransport: undefined | DappPostMessageTransport

preferredNetwork

preferredNetwork: NetworkType

Protected Readonly rateLimit

rateLimit: number = 2

How many requests can be sent after another

Protected Readonly rateLimitWindowInSeconds

rateLimitWindowInSeconds: number = 5

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

Protected requestCounter

requestCounter: number[] = ...

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

Protected storage

storage: Storage

Accessors

beaconId

  • get beaconId(): Promise<string>

connectionStatus

Protected keyPair

  • get keyPair(): Promise<KeyPair>

ready

  • get ready(): Promise<void>

Protected transport

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

Methods

Protected addListener

  • addListener(transport: Transport<any, any, any>): Promise<void>

Private addOpenRequest

addPeer

  • addPeer(peer: PeerInfo): Promise<void>

addRequestAndCheckIfRateLimited

  • addRequestAndCheckIfRateLimited(): Promise<boolean>

checkPermissions

  • Check if we have permissions to send the specific message type to the active account. If no active account is set, only permission requests are allowed.

    Parameters

    Returns Promise<boolean>

clearActiveAccount

  • clearActiveAccount(): Promise<void>

destroy

  • destroy(): Promise<void>

Private disconnect

  • disconnect(): Promise<void>

getAccount

  • getAccount(accountIdentifier: string): Promise<undefined | AccountInfo>

getAccounts

getActiveAccount

getAppMetadata

getColorMode

getOwnAppMetadata

Private getPeer

getPeers

Private getWalletInfo

Private handleRequestError

hideUI

  • hideUI(): Promise<void>

init

initInternalTransports

  • initInternalTransports(): Promise<void>

Private makeRequest

  • makeRequest<T, U>(requestInput: Optional<T, IgnoredRequestInputProperties>): Promise<{ connectionInfo: ConnectionContext; message: U }>
  • This method handles sending of requests to the DApp. It makes sure that the DAppClient is initialized and connected to the transport. After that rate limits and permissions will be checked, an ID is attached and the request is sent to the DApp over the transport.

    Type parameters

    Parameters

    • requestInput: Optional<T, IgnoredRequestInputProperties>

      The BeaconMessage to be sent to the wallet

    Returns Promise<{ connectionInfo: ConnectionContext; message: U }>

Private notifySuccess

removeAccount

  • removeAccount(accountIdentifier: string): Promise<void>

Private removeAccountsForPeers

removeAllAccounts

  • removeAllAccounts(): Promise<void>

removeAllPeers

  • removeAllPeers(sendDisconnectToPeers?: boolean): Promise<void>
  • Remove all peers and all accounts that have been connected through those peers

    Parameters

    • sendDisconnectToPeers: boolean = false

    Returns Promise<void>

removePeer

  • removePeer(peer: ExtendedPeerInfo, sendDisconnectToPeer?: boolean): Promise<void>

requestBroadcast

requestOperation

  • This method sends an OperationRequest to the wallet. This method should be used for all kinds of operations, eg. transaction or delegation. Not all properties have to be provided. Data like "counter" and fees will be fetched and calculated by the wallet (but they can still be provided if required).

    Parameters

    Returns Promise<OperationResponse>

requestPermissions

  • Send a permission request to the DApp. This should be done as the first step. The wallet will respond with an publicKey and permissions that were given. The account returned will be set as the "activeAccount" and will be used for the following requests.

    Parameters

    • Optional input: RequestPermissionInput

      The message details we need to prepare the PermissionRequest message.

    Returns Promise<PermissionResponseOutput>

requestSignPayload

Protected sendDisconnectToPeer

  • sendDisconnectToPeer(peer: PeerInfo, transport?: Transport<any, any, any>): Promise<void>

Private sendInternalError

  • sendInternalError(errorMessage: string): Promise<void>

setActiveAccount

  • setActiveAccount(account?: AccountInfo): Promise<void>

Protected setActivePeer

setColorMode

  • setColorMode(colorMode: ColorMode): Promise<void>

Protected setTransport

  • setTransport(transport?: Transport<any, any, any>): Promise<void>

showPrepare

  • showPrepare(): Promise<void>

subscribeToEvent

  • subscribeToEvent<K>(internalEvent: K, eventCallback: BeaconEventHandlerFunction<BeaconEventType[K]>): Promise<void>
  • Allows the user to subscribe to specific events that are fired in the SDK

    Type parameters

    Parameters

    • internalEvent: K

      The event to subscribe to

    • eventCallback: BeaconEventHandlerFunction<BeaconEventType[K]>

      The callback that will be called when the event occurs

    Returns Promise<void>

Generated using TypeDoc