API Reference
CasperDash injects a global API into websites visited by its users at window.casperDashHelper
. This API allows websites to request users' Casper accounts, read data from blockchains the user is connected to, and suggest that the user sign messages and transactions.
Methods
casperDashHelper.requestConnection()
Requests a connection to the DApp
casperDashHelper.requestSwitchAccount()
Requests to switch connected account
casperDashHelper.isConnected()
Returns true
if the provider is connected to the current chain, and false
otherwise
casperDashHelper.disconnectFromSite()
Requests a disconnection from the Casper Network DApp
casperDashHelper.signMessage()
Suggest that the user sign a message
casperDashHelper.sign()
Suggest that the user sign a deploy
casperDashHelper.getActivePublicKey()
Return the current connected account's public key
Events
connected
The CasperDash provider emits this event when it first becomes able to submit RPC requests to a chain. We recommend using a connect
event handler and the casperDashHelper.isConnected method in order to determine when/if the provider is connected.
disconnected
The CasperDash provider emits this event if it becomes unable to submit RPC requests to any chain. In general, this will only happen due to network connectivity issues, some unforeseen error or DApp invokes casperDashHelper.disconnectFromSite() method.
activeKeyChanged
The CasperDash provider emits this event whenever the return value of the activeKey
changes. This means that activeKeyChanged
will be emitted whenever the user's exposed account address changes.
Last updated