npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@s3panyol/use-evm-transaction-flow

v0.1.0-beta.10

Published

Composable transaction hook for EVM (ERC20/ERC721/ERC1155 + ETH) using Viem and Wagmi

Downloads

57

Readme

useEvmTransactionFlow

🧠 Smart, flexible transaction flow hook for EVM-based apps (React + Wagmi + Viem)

Features

  • ✅ Handles ERC20, ERC721, ERC1155 and ETH
  • 🔁 Optional approval flow
  • ✅ Transaction confirmation tracking
  • 🧪 Simulates contract calls before execution
  • 🔗 Viem, Wagmi, TanStack Query native
  • 💡 Built for composability and clarity
  • 💪 Works with:
    • ConnectKit (https://family.co/docs/connectkit)
    • RainbowKit (https://rainbowkit.com/de/docs/introduction)
    • AppKit (https://docs.reown.com/appkit/overview)

Installation

npm install @s3panyol/use-evm-transaction-flow

Usage

Hook

useEvmClients

const {
  walletClient, // wallet client that will get used for writing transaction
  publicClient, // client for reading from the network
  account, // address of the connected account
  accounts, // addesses of all connected accounts
  isConnected, // flag is a wallet is connected
  isReady, // flag if client is fully usable
} = useEvmClients();

useEvmTransactionFlow

const {
    run, // executes the process
    step, // text representation of hook status
    error, // stores the error message
    reset, // resets the hook to its initial state "idle"
    approveHash, // provides the approval transaction hash, in case it's needed
    executeHash, // provides the execution transaction hash, in case it's needed
    isIdle, // initial state
    isReadyToExecute, // flag if approval is necessary
    isCheckingAllowance, // flag for checking allowance if not ETH
    isPendingApprove, // tanstack query flag isPending of approval execution
    isWaitingForApproval, // internal flag for being in approval
    isWaitingForApprovalTxConfirmation, // flag for approval transaction still not having a receipt (good for load balanced RPCs)
    isExecuting, // flag if hook is in execution mode, which is the actual function call that should transfer the token/ETH
    isPendingExecuting, // tanstack query flag isPending of main function execution
    isWaitingForExecutionTxConfirmation, // flag for execution transaction still not having a receipt
    isSuccess, // if everything is finished, this flag will be true
    isError, // true on error
    isReady, // equivalent of isReadyToExecute // TODO cleanup
} = useEvmTransactionFlow({
...
}: UseEvmTransactionFlowParams);

interface UseEvmTransactionFlowParams {
  tokenType: TokenType; // ERC20 | ERC721 | ERC1155 | NATIVE
  tokenAddress: Address; // Target contract address
  spender?: Address; // Optional: Who will spend tokens (if approval needed)
  tokenId?: bigint; // For ERC721/ERC1155
  amount?: bigint; // For ERC20/ERC1155
  confirmations?: number; // Defaults to 1
  requireExplicitApproval?: boolean; // set to true if you want to force approval
  contractAddress: Address; // address that should be called to execute `functionName`
  abi: Abi; // see viem documentation
  functionName: string; // see viem documentation
  args: unknown[]; // see viem documentation
}

Trigger run()

const handleClick = () => {
  run();
};

TODOs

[ ] sophisticated status handling
[ ] proper integration testing with wagmi mock
[ ] tbd...

License

MIT