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

polymer-viem

v1.0.1

Published

A plugin for Viem that adds Polymer proof capabilities, allowing you to generate and verify cross-chain transaction proofs.

Readme

Polymer Viem Plugin

A plugin for Viem that adds Polymer proof capabilities, allowing you to request and verify cross-chain transaction proofs.

Overview

The Polymer Viem Plugin extends Viem with the ability to generate proofs from the Polymer Prove API for transactions. These proofs can be used to verify the existence and validity of transaction events across different blockchains, enabling secure cross-chain communication.

What is Polymer?

Polymer makes cross-rollup interoperability fast and easy for application builders. Find out more at Polymer Labs.

Installation

npm install polymer-viem viem
# or
yarn add polymer-viem viem
# or
pnpm add polymer-viem viem

Usage

Using Viem's Extension System

import { createPublicClient, http } from "viem";
import { mainnet } from "viem/chains";
import { polymer } from "polymer-viem";

// Initialize a Viem client with the Polymer plugin
const client = createPublicClient({
  chain: mainnet,
  transport: http(),
}).extend(
  polymer({
    apiKey: "YOUR_POLYMER_API_KEY",
    debug: true, // Optional
  })
);

// Generate a proof using a transaction receipt
const receipt = await client.getTransactionReceipt({
  hash: "0x123...",
});

const result = await client.polymerProof({
  receipt,
  eventSignature: "Transfer(address,address,uint256)",
});

// If the proof is processed asynchronously, you'll get a job ID
if ("jobId" in result) {
  console.log(`Proof requested! Job ID: ${result.jobId}`);
  // Wait for the proof to be generated
  const finalResult = await client.polymer.wait(result.jobId);
  console.log("Proof:", finalResult.proof);
} else {
  console.log("Proof:", result.proof);
}

API Reference

Plugin Configuration

When initializing the plugin, you can provide the following configuration options:

polymer({
  apiKey: "YOUR_API_KEY", // Required
  apiUrl: "POLYMER_API_URL", // Optional, defaults to Polymer testnet
  maxAttempts: 20, // Optional, default: 20
  interval: 3000, // Optional, default: 3000ms
  timeout: 60000, // Optional, default: 60000ms
  debug: false, // Optional, default: false
});

Configuration Options

| Option | Description | Default | | ----------- | ---------------------------------- | ---------------------------------- | | apiKey | Your Polymer API key (required) | null | | apiUrl | URL of the Polymer API | https://proof.testnet.polymer.zone | | maxAttempts | Maximum number of polling attempts | 20 | | interval | Polling interval in milliseconds | 3000 | | timeout | Request timeout in milliseconds | 60000 | | debug | Enable debug logging | false |

Plugin Methods

The plugin adds the following methods to the Viem client:

| Method | Description | | ------------------------------- | -------------------------------------------------------- | | client.polymerProof | Request a proof for a transaction receipt | | client.polymer.requestProof | Request a proof for specific block, transaction, and log | | client.polymer.queryProofStatus | Check the status of a proof generation job | | client.polymer.wait | Wait for a proof to be generated |

client.polymerProof(options)

Requests a proof for a transaction receipt.

Parameters:

  • options (Object):
    • receipt (TransactionReceipt): The transaction receipt
    • eventSignature (string, optional): The event signature to generate a proof for
    • logIndex (number, optional): The log index of the event to generate a proof for
    • maxAttempts (number, optional): Maximum number of polling attempts
    • interval (number, optional): Polling interval in milliseconds

Note: Either eventSignature or logIndex must be provided.

Returns:

  • Promise<PolymerProofResult | PolymerProofJobResult>: A promise that resolves to either the proof result or a job ID

client.polymer.requestProof(options)

Requests a proof for a specific block, transaction, and log.

Parameters:

  • options (Object):
    • srcChainId (number): The source chain ID
    • srcBlockNumber (bigint | number): The source block number
    • txIndex (number): The transaction index in the block
    • logIndex (number): The log index in the transaction

Returns:

  • Promise<string>: A promise that resolves to the job ID

client.polymer.queryProofStatus(jobId)

Checks the status of a proof generation job.

Parameters:

  • jobId (string): The job ID from the proof request

Returns:

  • Promise<PolymerProofStatusResult>: A promise that resolves to the job status

client.polymer.wait(jobId, options)

Waits for a proof to be generated.

Parameters:

  • jobId (string): The job ID from the proof request
  • options (Object, optional):
    • maxAttempts (number, optional): Maximum number of polling attempts
    • interval (number, optional): Polling interval in milliseconds

Returns:

  • Promise<PolymerProofResult>: A promise that resolves to the proof result

Examples

Check out the examples directory for complete working examples.

To run the example:

  1. Install dependencies:

    npm install
  2. Create a .env file with your Polymer API key:

    cp .env.example .env
    # Edit .env and add your Polymer API key
  3. Run the example:

    npm run receipt

License

MIT