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

@vetro-protocol/bridge

v1.0.0

Published

Vetro Protocol bridge actions for viem (LayerZero V2 OFT).

Readme

@vetro-protocol/bridge

LayerZero V2 OFT/OFTAdapter bridge actions for viem clients. Generic — works with any pair of tokens that have OFT contracts deployed on the supported chains.

Installation

pnpm add @vetro-protocol/bridge viem viem-erc20

Overview

  • Works with both pure OFT contracts and OFTAdapter contracts.
  • Approval is auto-detected via on-chain approvalRequired(). When required, the underlying ERC20 is read from token() and the standard allowance/approve flow runs before the send.
  • Caller owns chain/contract addressing; the package only knows the chainId → LayerZero EID mapping (see the table below).
  • Slippage defaults to zero (minAmountLD === amount); pass minAmount to opt in to a tolerance.

Supported chains (chainId → LayerZero EID):

| Chain | chainId | EID | | ---------------- | ------- | ----- | | Ethereum mainnet | 1 | 30101 | | Optimism | 10 | 30111 | | BSC | 56 | 30102 | | Base | 8453 | 30184 | | Arbitrum | 42161 | 30110 | | Hemi | 43111 | 30329 |

Usage

import { quoteSend, send } from "@vetro-protocol/bridge/actions";
import { createPublicClient, createWalletClient, custom, http } from "viem";
import { hemi, mainnet } from "viem/chains";

const publicClient = createPublicClient({
  chain: mainnet,
  transport: http(),
});

const walletClient = createWalletClient({
  chain: mainnet,
  transport: custom(window.ethereum),
});

// 1. Quote the LayerZero messaging fee
const fee = await quoteSend(publicClient, {
  amount: 1_000_000_000_000_000_000n,
  destinationChainId: hemi.id,
  oftAddress: "0x5fFD0EAdc186AF9512542d0d5e5eAFC65d5aFc5B",
  recipient: "0x...",
});

// 2. Send (approval handled automatically when the OFT requires it)
const { emitter, promise } = send(walletClient, {
  amount: 1_000_000_000_000_000_000n,
  destinationChainId: hemi.id,
  oftAddress: "0x5fFD0EAdc186AF9512542d0d5e5eAFC65d5aFc5B",
  recipient: "0x...",
});

emitter.on("user-signed-send", (hash) => console.log("tx hash:", hash));
emitter.on("send-transaction-succeeded", (receipt) =>
  console.log("delivered:", receipt),
);

await promise;

The same actions are also available via .extend() factories (bridgePublicActions(), bridgeWalletActions()) for callers who prefer viem's extension pattern.

Events

The send wallet action emits the following events through the EventEmitter:

| Event | Payload | When | | ------------------------------- | ---------------------- | --------------------------------------------------------------------------------------------------------------------- | | pre-approve | [] | Before the ERC20 approval transaction (only when approvalRequired() === true and current allowance is insufficient) | | user-signed-approval | [Hash] | The user signed the approval transaction | | user-signing-approval-error | [Error] | The user rejected or otherwise failed to sign the approval | | approve-transaction-succeeded | [TransactionReceipt] | Approval transaction confirmed successfully | | approve-transaction-reverted | [TransactionReceipt] | Approval transaction reverted on-chain | | pre-send | [] | Before the OFT send transaction | | user-signed-send | [Hash] | The user signed the send transaction | | user-signing-send-error | [Error] | The user rejected or otherwise failed to sign the send | | send-transaction-succeeded | [TransactionReceipt] | Send transaction confirmed successfully | | send-transaction-reverted | [TransactionReceipt] | Send transaction reverted on-chain | | send-failed | [Error] | A transaction-receipt fetch failed | | send-failed-validation | [string] | Input validation failed; payload is a human-readable reason | | unexpected-error | [Error] | An unhandled error escaped the action | | send-settled | [] | Always emitted in the finally block |

API

  • quoteSend(client, params) — public action; reads the LayerZero messaging fee for a send.
  • approvalRequired(client, params) — public action; reads approvalRequired() on the OFT/OFTAdapter.
  • token(client, params) — public action; reads the underlying ERC20 wrapped by an OFTAdapter.
  • send(walletClient, params) — wallet action; runs the full bridge flow (auto-approval + send) and returns { emitter, promise }.
  • encodeSend(params) — synchronous helper that returns the encoded send calldata. The caller must pre-quote the LayerZero fee (e.g. with quoteSend) and pass it in.
  • bridgePublicActions() / bridgeWalletActions() — viem extension factories that wire the same actions onto a client via .extend().
  • oftAbi — the minimal ABI subset used by the package (send, quoteSend, approvalRequired, token).
  • Types: SendEvents.