Pelagus Wallet

website·Indexed 33 days ago

https://pelaguswallet.io/docs/

A community-owned, open-source, self-custodial browser wallet for the Quai Network. Provides a provider interface via window.pelagus.request for interacting with the network.

Tokens
631
Snippets
3
Records
5
Agent score
18%

What's inside Pelagus

  1. Overview of Pelagus Wallet

    Pelagus is a community-owned, open-source, self-custodial browser extension wallet for the Quai Network. It supports Quai's sharded multi-chain architecture and dual-token model (QUAI and Qi). Keys are generated and stored locally on the user's device; there are no centralized accounts or servers holding funds. It is available for Chrome, Brave, Edge, and Opera, with Firefox support available from source.
  2. Integrate Pelagus with autonomous clients

    Pelagus does not provide a headless or remote API. The provider only exists within a browser where the extension is installed, and every transaction or signature requires explicit on-device user approval. To automate transaction preparation, use quais.js against a Quai RPC node to construct the transaction, then pass it to Pelagus for the user to sign and submit.
  3. Build Quai transactions using quais.js

    To ensure addresses are sharded correctly, developers should use the quais.js library instead of ethers.js when building transactions for the Pelagus provider.
    import { BrowserProvider } from 'quais';
    
    const provider = new BrowserProvider(window.pelagus);
  4. Listen to Pelagus Wallet Events

    The Pelagus provider allows dApps to listen for state changes using window.pelagus.on. Supported events include:

    • accountsChanged: Triggered when the list of authorized accounts changes.
    • chainChanged: Triggered when the active zone/chain is switched.
    • connect: Triggered when the wallet connects.
    • disconnect: Triggered when the wallet disconnects.
    window.pelagus.on('chainChanged', (chainId) => {
      console.log(`Chain changed to ${chainId}`);
    });
  5. Interact with Pelagus via the EIP-1193 Provider

    Pelagus injects an EIP-1193 compliant provider at window.pelagus (announced via EIP-6963). Developers can interact with the wallet by calling window.pelagus.request({ method, params }).

    Commonly used methods include:

    • quai_requestAccounts / eth_requestAccounts: Prompts the user to connect and returns authorized accounts.
    • quai_accounts: Returns currently connected accounts without prompting the user.
    • quai_chainId: Returns the current zone/chain ID (e.g., 0x9).
    • personal_sign: Signs a human-readable message.
    • quai_sendTransaction: Builds, signs, and broadcasts a transaction (requires explicit user approval).
    • wallet_switchEthereumChain / wallet_addEthereumChain: Changes the active zone and triggers the chainChanged event.
    • wallet_requestPermissions / wallet_getPermissions: Manages EIP-2255 permissions.
    // Example: Requesting accounts
    const accounts = await window.pelagus.request({ 
      method: 'quai_requestAccounts' 
    });