⛓ Establishing a Connection
BoltX injects a global API (window.boltX
) into websites visited by users. This API allows websites to request access to user's BoltX addresses, read data from blockchains the user is connected to, and suggest that the user sign messages and transactions.
First and foremost, the application needs to be connected to the BoltX. BoltX has API in order to enable user connect to various blockchains: Ethereum, Zilliqa and Carbon(former Tradehub).
Sample code for Zilliqa:
Sample code for Ethereum:
Sample code for Carbon(former Tradehub):
Properties:
boltX.isBoltX
boltX.isBoltX
Note: Non-BoltX providers may also set this property to true
.
true
if the user has Bolt-X installed
boltX.isConnected
boltX.isConnected
true
if there is an active communication between extension and boltX
boltX.isUnlocked
boltX.isUnlocked
true
if the user's Bolt-X extension is unlocked
boltX.events
boltX.events
Mapping of events that are emitted by
window.boltX
Methods:
boltX.connectAll()
boltX.connectAll()
connect to all Blockchains
(ie: request addresses for all supported blockchains)
Events
The boltX
object inherits the eventEmitter
methods and emits the following events.
connectionChanged
connectionChanged
Emitted when
isConnected
changesUseful for tracking when the wallet is connected to the website
Recommended action is to initiate a page refresh
unlockChanged
unlockChanged
Emitted when
isUnlocked
changesUseful for tracking when the wallet is locked and requires another call of connect methods to prompt the user to re-login.
Usage will be up to the developer's discretion
Blockchain
boltX.zilliqa
Same structure as @zilliqa-js
boltX.ethereum
Compliant to EIP-1193: Ethereum Provider JavaScript API
Compliant to EIP-695: Create `eth_chainId` method for JSON-RPC
Compliant to EIP-2696: JavaScript `request` method RPC transport
Compliant to EIP-2700: JavaScript Provider Event Emitter
boltX.tradehub
Similar to
boltX.ethereum
provider structureboltX.tradehub.request
makes requests using public endpointsie. no authentication
boltX.tradehub.sendTx
makes requests using private endpointsie. with authentication
Last updated