Carbon
Carbon is a cross-chain protocol that acts as a building block for DeFi.https://carbon.network/
Properties
boltX.tradehub.isBoltX
boltX.tradehub.isBoltX
Note: Non-BoltX providers may also set this property to true
.
true
if the Tradehub provider belongs to Bolt-X
boltX.tradehub.isConnected
boltX.tradehub.isConnected
true
if the provider can process RPC requestsIn other words,
true
if there is an active communication between the extension and the Tradehub provider
boltX.tradehub.selectedAddress
boltX.tradehub.selectedAddress
The current Tradehub address that the BoltX wallet is on.
boltX.tradehub.network
boltX.tradehub.network
The network type that the user is currently connected to
'mainnet' | 'testnet' | 'devnet' | 'localhost'
boltX.tradehub.state
boltX.tradehub.state
The state of the wallet provider
boltX.tradehub.TradehubEndpoints
boltX.tradehub.TradehubEndpoints
The array of supported Tradehub public endpoints path for
boltX.tradehub.request
Methods
boltX.tradehub.connect()
boltX.tradehub.connect()
Requests user permission to connect the Zilliqa provider to the extension and requests user's Zilliqa address
Returns boolean indicating whether the wallet is connected
boltX.tradehub.sendTx({ type, value })
boltX.tradehub.sendTx({ type, value })
Submits a tx request for the given raw message onto the chain. Calls popup to get user's confirmation on the transaction.
This method is only for private endpoints and are messages that requires signing.
@see https://docs.switcheo.org/#/?id=private-endpoints
The switcheo documentation is currently outdated. For more details on the types of private endpoints and the required parameters, see tradehub's modules folder
Params:
type: The message type (e.g.
order/MsgCreateOrder
)value: The message details
Returns the transaction response (TxResponse)
Throws an error when user rejects or transaction broadcast/signing failed
boltX.tradehub.request({ path, params })
boltX.tradehub.request({ path, params })
Submits an API request to the specified path, with the given params.
As these are public endpoints, user authentication is not required since the provider does not provide any additional user information or signing capability
@see https://docs.switcheo.org/#/?id=public-endpoints
The switcheo documentation is currently outdated. For more details on the types of public endpoints path and the required params, see tradehub's rest endpoints and the APIClient
Params:
type: the path to make a request to
value: object map for query parameters
Returns the transaction response (TxResponse)
Example usage:
Events
The boltX.tradehub
object inherits the eventEmitter
methods and emits the following events.
connected
connected
Emitted when wallet is connected to Bolt-X extension
disconnected
disconnected
Emitted when loses connection with Bolt-X extension
accountsChanged
accountsChanged
Emits the new
defaultAccount
when account change is detected
networkChanged
networkChanged
Emits the new network type (
'mainnet' | 'testnet' | 'devnet' | 'localhost'
) when network change is detected
Last updated