Wagmi Documentation

website·Indexed 37 days ago

https://beta.wagmi.sh

Documentation for Wagmi hooks and actions, featuring tools for interacting with the Stablecoin DEX orderbook (dex) and Fee AMM (amm). Includes APIs for minting and burning liquidity, managing limit and flip orders, and tracking pool reserves and balances.

Tokens
321.1K
Snippets
1.6K
Records
2.2K
Agent score
56%

What's inside Wagmi

  1. Overview of Wagmi for Ethereum Application Development

    Wagmi is a library designed to simplify the complexities of building Ethereum applications. It abstracts difficult tasks such as connecting wallets, managing multi-chain support, signing messages/data, sending transactions, and listening for blockchain events. It is built on top of Viem and integrates with TanStack Query for data layer performance (caching, deduplication, and persistence).
  2. Overview of Wagmi for Ethereum development

    Wagmi is a library designed to simplify the process of building Ethereum applications. It abstracts the complexities of connecting wallets, managing multi-chain support, signing messages/data, sending transactions, and listening for blockchain events. It is built on top of Viem and integrates with TanStack Query for data layer performance (caching, deduplication, and persistence).
  3. Overview of Wagmi Core

    Wagmi Core is a modular and composable library for building Ethereum applications. It abstracts the complexities of connecting wallets, multi-chain support, signing messages, sending transactions, and listening for blockchain events. It is built by the same team behind Viem and is designed to be framework-agnostic, allowing it to be plugged into frameworks like Vue and Svelte via framework adapters.
  4. Overview of TanStack Query in Wagmi Vue

    Wagmi Composables use TanStack Query to manage asynchronous data in Vue applications. This integration handles loading/error states, race conditions, and caching.

    • Queries: Used for fetching data (e.g., reading a contract). They are tied to a unique Query Key and typically run on mount.
    • Mutations: Used for changing data or triggering side-effects (e.g., writing to a contract, switching chains). They are not tied to a query key and are usually triggered by user interaction.
  5. Overview of wagmi React Hooks

    wagmi provides a collection of React Hooks designed to simplify interactions with Ethereum-like blockchains. These hooks cover essential functionality including account management, wallet connectivity, contract interactions, transaction handling, signing, and ENS (Ethereum Name Service) resolution.
    import { useConnection } from 'wagmi'
  6. Overview of supported Tempo Connectors

    Tempo connectors are thin Wagmi wrappers around the root accounts package. The following connectors are supported:

    • tempoWallet: Used for the Tempo Wallet dialog.
    • webAuthn: Used for a WebAuthn Externally Owned Account (EOA).
    • dangerous_secp256k1: Used for a secp256k1 (private key) EOA.
  7. Overview of @wagmi/solid

    @wagmi/solid is a library that brings the Wagmi developer experience to SolidJS applications. It allows developers to build Ethereum applications using Solid's reactive primitives, leveraging Solid's fine-grained reactivity and high performance for blockchain interactions.
  8. Use Wagmi Solid Actions for imperative blockchain operations

    @wagmi/solid exports all actions from @wagmi/core. These actions provide lower-level, imperative control and are designed for use outside of Solid components or when you need to chain multiple operations together without the overhead of reactivity.
    import { getBalance, sendTransaction } from '@wagmi/solid/actions'
  9. Understand the return type of policy.modifyWhitelist

    When calling the synchronous modifyWhitelistSync action, the return type provides details about the modification and the transaction receipt.
    type ReturnType = {
      /** Address that was added/removed from whitelist */
      account: Address
      /** Whether the address is allowed */
      allowed: boolean
      /** ID of the policy */
      policyId: bigint
      /** Transaction receipt */
      receipt: TransactionReceipt
      /** Address that modified the whitelist */
      updater: Address
    }
  10. Understand the `onBurn` event arguments

    The onBurn callback provides an Args object containing the following details about the liquidity burn event:
    type Args = {
      /** Amount of user token received */
      amountUserToken: bigint
      /** Amount of validator token received */
      amountValidatorToken: bigint
      /** Amount of LP tokens burned */
      liquidity: bigint
      /** Address that removed liquidity */
      sender: Address
      /** Address that received the tokens */
      to: Address
      /** Address of the user token */
      userToken: Address
      /** Address of the validator token */
      validatorToken: Address
    }
  11. Understand the amm.mint return type

    The amm.mintSync action (or the extracted event from amm.mint) returns an object containing the following details about the liquidity minting operation:
    type ReturnType = {
      amountUserToken: bigint      // Amount of user tokens provided
      amountValidatorToken: bigint // Amount of validator tokens provided
      liquidity: bigint           // Amount of liquidity tokens minted
      receipt: TransactionReceipt // Transaction receipt
      sender: Address             // Address that initiated the mint
      userToken: Address          // Address of the user token
      validatorToken: Address      // Address of the validator token
    }
  12. Configure Transports in wagmi

    Transports are the intermediary layer responsible for executing outgoing JSON-RPC requests to an RPC Provider (such as Alchemy or Infura). When instantiating a wagmi configuration using createConfig, you must provide a set of Transports for each chain.