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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@wonderland/interop-cross-chain

v0.1.1

Published

Cross-chain interoperability library with standardized provider interface

Downloads

324

Readme

interop-sdk: cross-chain package

The cross-chain package provides a standardized interface for interacting with cross-chain bridges and protocols. It enables seamless token transfers and swaps between different blockchain networks through a unified API.

Key features:

  • Cross-chain token transfers between supported networks
  • Cross-chain token swaps with customizable slippage
  • Quote fetching for cross-chain operations
  • Standardized provider interface for integrating different bridge protocols
  • Type-safe interactions with comprehensive TypeScript support

Setup

  1. Install dependencies running pnpm install

Available Scripts

Available scripts that can be run using pnpm:

| Script | Description | | ------------- | ------------------------------------------------------- | | build | Build library using tsc | | check-types | Check types issues using tsc | | clean | Remove dist folder | | lint | Run ESLint to check for coding standards | | lint:fix | Run linter and automatically fix code formatting issues | | format | Check code formatting and style using Prettier | | format:fix | Run formatter and automatically fix issues | | test | Run tests using vitest | | test:cov | Run tests with coverage report |

Usage

import {
    AcrossProvider,
    createCrossChainProvider,
    createProviderExecutor,
    InteropAddressParamsParser,
    ProviderExecutor,
} from "@interop-sdk/cross-chain";

// Create a provider for a specific protocol (e.g., Across)
const provider = createCrossChainProvider("across");

// Get a quote for a cross-chain transfer
const quote = await provider.getQuote("crossChainTransfer", {
    sender: "0x...", // sender address (hex)
    recipient: "0x...", // recipient address (hex)
    inputTokenAddress: "0x...", // input token address
    outputTokenAddress: "0x...", // output token address
    inputAmount: "1000000000000000000", // amount in wei
    inputChainId: 11155111, // source chain ID
    outputChainId: 84532, // destination chain ID
});

// Simulate the open transaction for the quote
const txs = await provider.simulateOpen(quote.openParams);

// Batch quotes and execution using ProviderExecutor
const providers = [provider];
const executor = createProviderExecutor(providers);
const quotes = await executor.getQuotes("crossChainTransfer", {
    sender: "0x...",
    recipient: "0x...",
    inputTokenAddress: "0x...",
    outputTokenAddress: "0x...",
    inputAmount: "1000000000000000000",
    inputChainId: 11155111,
    outputChainId: 84532,
});

// Execute a quote (simulate open)
const txRequests = await executor.execute(quotes[0]);

// Using InteropAddressParamsParser for human-readable or binary addresses
const paramParser = new InteropAddressParamsParser();
const executorWithParser = createProviderExecutor(providers, { paramParser });
const quotesWithInterop = await executorWithParser.getQuotes("crossChainTransfer", {
    sender: "alice.eth@eip155:1#ABCD1234", // human-readable interop address
    recipient: "0x...", // hex address
    amount: "1000000000000000000",
    inputTokenAddress: "0x...",
    outputTokenAddress: "0x...",
});

API

Providers

  • createCrossChainProvider(protocolName, config?, dependencies?) – Create a provider for a supported protocol (e.g., "across").
  • CrossChainProvider (abstract class)
    • .getProtocolName() – Returns the protocol name.
    • .getQuote(action, params) – Fetch a quote for a cross-chain action ("crossChainTransfer" or "crossChainSwap").
    • .simulateOpen(openParams) – Simulate the open transaction for a quote.
    • .validateOpenParams(openParams) – Validate open parameters.

Provider Executor

  • createProviderExecutor(providers, dependencies?) – Create an executor for batch quoting and execution.
  • ProviderExecutor
    • .getQuotes(action, params) – Get quotes from all providers.
    • .execute(quote) – Simulate the open transaction for a quote.

Param Parsers

  • InteropAddressParamsParser – Parses human-readable or binary interop addresses for use in cross-chain actions.
  • ParamsParser (interface) – Custom param parsers can be implemented for advanced use cases.

Types

  • GetQuoteParams<Action> – Parameters for quoting (see crossChainProvider.interface.ts).
  • GetQuoteResponse<Action, OpenParams> – Quote response structure.
  • BasicOpenParams, Fee, and more (see exported types).

Supported Actions

  • crossChainTransfer – Transfer tokens between chains.
  • crossChainSwap – Swap tokens across chains (if supported by the protocol).

References

The current SDK uses Across on testnet for demo purposes only. Performance may not reflect mainnet behavior and is not representative of the final production experience