Ethereum

Properties

boltX.ethereum.isBoltX

Note: Non-BoltX providers may also set this property to true.

  • true if the Ethereum provider belongs to Bolt-X

boltX.ethereum.isConnected

  • true if the provider can process RPC requests

  • In other words, true if there is an active communication between the extension and the Ethereum provider

boltX.ethereum.selectedAddress

  • The current Ethereum address that the BoltX wallet is on.

boltX.ethereum.chainId

  • The chainId that the user is currently connected to (in hexadecimal string)

boltX.ethereum.state

  • The state of the wallet provider

interface BaseProviderState {
  accounts: null | string[];
  isConnected: boolean;
  isUnlocked: boolean;
}

Methods

boltX.ethereum.request({ method, params })

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

  • Supported RPC Methods:

    • Account request methods

    • Account retrieval methods

      • eth_accounts

      • eth_coinbase

    • Restricted methods (require user verifications)

      • eth_sendTransaction

      • eth_sign

      • eth_signTypedData

    • Unrestricted methods

      • eth_blockNumber

      • eth_call

      • eth_chainId

      • eth_estimateGas

      • eth_gasPrice

      • eth_getBalance

      • eth_getBlockByHash

      • eth_getBlockByNumber

      • eth_getBlockTransactionCountByHash

      • eth_getBlockTransactionCountByNumber

      • eth_getCode

      • eth_getFilterChanges

      • eth_getFilterLogs

      • eth_getLogs

      • eth_getProof

      • eth_getStorageAt

      • eth_getTransactionByBlockHashAndIndex

      • eth_getTransactionByBlockNumberAndIndex

      • eth_getTransactionByHash

      • eth_getTransactionCount

      • eth_getTransactionReceipt

      • eth_getUncleByBlockHashAndIndex

      • eth_getUncleByBlockNumberAndIndex

      • eth_getUncleCountByBlockHash

      • eth_getUncleCountByBlockNumber

      • eth_newBlockFilter

      • eth_newFilter

      • eth_newPendingTransactionFilter

      • eth_protocolVersion

      • eth_sendRawTransaction // no signing so its safe

      • eth_syncing

      • eth_uninstallFilter

      • net_listening

      • net_version

      • web3_clientVersion

      • web3_sha3

  • Unsupported RPC Methods:

    • Work related

      • eth_mining

      • eth_getWork

      • eth_hashrate

      • eth_submitHashrate

      • eth_submitWork

    • Unsupported for security reasons

      • eth_signTransaction

    • Metamask methods // (might or might not implement based on usability)

      • personal_ecRecover

      • personal_sign

      • wallet_addEthereumChain

      • wallet_switchEthereumChain

      • wallet_registerOnboarding

      • wallet_watchAsset

      • eth_decrypt

      • eth_getEncryptionPublicKey

    • Others

      • net_peerCount

References:

boltX.ethereum.enable()

Deprecated method that is pending removal. Provided to support existing dApps implementation.

Use request({ method: 'eth_requestAccounts' }) instead

Equivalent to: ethereum.request('eth_requestAccounts').

  • Returns the Ethereum address

  • Throws an error if rejected

Events

The boltX.ethereum provider inherits the eventEmitter methods and emits the following events.

Compliant to EIP-2700: JavaScript Provider Event Emitter

Read EIP-1193#events to see the event return type and the rationale.

connect

  • Emitted when provider first connect to a chain after initialization

  • Emitted when provider connects to a chain after disconnect event

  • Returns { chainId: string }

disconnect

  • Emits a ProviderRpcErrorwhen the provider is disconnected (cannot process JSON RPC request).

chainChanged

  • Emits the chainId when the chain the provider is connected to changes.

accountsChanged

  • Emits the accounts: string[] when the accounts available to the Provider change.

  • The account addresses is per the eth_accounts Ethereum RPC method.

message

  • Intended for arbitrary notifications not covered by other events

  • For example, subscription event (Not supported)

Last updated