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

@mocanetwork/airkit-connector

v1.7.0

Published

AirKit wagmi connector to connect with the AirService

Readme

Air Kit Wagmi Connector

This connector is part of the Moca Network offering and provides seamless integration between the Air Kit SDK and the popular wagmi library for React applications.

⚡ Quick Start

npm install @mocanetwork/airkit-connector

Initialize & Connect

import { createConfig, http } from "wagmi";
import { mainnet, polygon } from "wagmi/chains";
import { airConnector } from "@mocanetwork/airkit-connector";
import { BUILD_ENV } from "@mocanetwork/airkit";

const config = createConfig({
  chains: [mainnet, polygon],
  transports: {
    [mainnet.id]: http(),
    [polygon.id]: http(),
  },
  connectors: [
    airConnector({
      partnerId: YOUR_PARTNER_ID,
      buildEnv: BUILD_ENV.SANDBOX,
      enableLogging: true,
    })
  ],
});

The airConnector integrates the Air Kit SDK with wagmi, providing a familiar wagmi interface while leveraging the full power of Air Account Login, Air Id Minting, and Air Account Management.

🔗 Installation

Dependencies

This connector requires the following peer dependencies:

npm install @wagmi/core viem

Bundling

This module is distributed in multiple formats:

  • esm build dist/airkitConnector.esm.js in es6 format
  • commonjs build dist/airkitConnector.cjs.js in es5 format
  • umd build dist/airkitConnector.umd.min.js in es5 format minified

By default, the appropriate format is used for your specified use case.

Usage

Once the connector is configured with your wagmi client, you can use all standard wagmi hooks and functions while the connector handles the Air Kit integration behind the scenes.

Basic Connection Example

import { useConnect, useAccount, useDisconnect } from "wagmi";
import { airConnector } from "@mocanetwork/airkit-connector";

function App() {
  const { connect, connectors } = useConnect();
  const { address, isConnected } = useAccount();
  const { disconnect } = useDisconnect();

  const handleConnect = () => {
    connect({ connector: connectors[0] });
  };

  return (
    <div>
      {isConnected ? (
        <div>
          <p>Connected to {address}</p>
          <button onClick={() => disconnect()}>Disconnect</button>
        </div>
      ) : (
        <button onClick={handleConnect}>Connect with Air Kit</button>
      )}
    </div>
  );
}

Advanced Connection with Auth Token

import { useConnect } from "wagmi";
import { airConnector } from "@mocanetwork/airkit-connector";

function App() {
  const { connect, connectors } = useConnect();

  const handleConnectWithAuth = () => {
    // Connect with a pre-existing auth token
    connect({ 
      connector: connectors[0],
      chainId: 1, // Optional: specify chain
      authToken: "your-auth-token" // Optional: pass auth token
    });
  };

  return (
    <button onClick={handleConnectWithAuth}>
      Connect with Auth Token
    </button>
  );
}

Chain Switching

import { useSwitchChain } from "wagmi";

function ChainSwitcher() {
  const { switchChain } = useSwitchChain();

  const switchToPolygon = () => {
    switchChain({ chainId: 137 }); // Polygon
  };

  return (
    <button onClick={switchToPolygon}>
      Switch to Polygon
    </button>
  );
}

🔧 Configuration

The airConnector accepts the following configuration parameters:

interface AirConnectorParams {
  partnerId: string;           // Required: Your Moca Network partner ID
  buildEnv: BUILD_ENV;         // Required: Environment (staging, production, etc.)
  enableLogging: boolean;      // Required: Enable/disable logging
  loginOptions?: {
    authToken?: string;        // Optional: Pre-existing auth token
  };
}

🚀 Features

  • Seamless Integration: Works with all wagmi hooks and functions
  • Air Kit Power: Full access to Air Account Login, Air Id Minting, and Account Management
  • Chain Support: Automatic chain switching and network management
  • Session Management: Handles Air Kit session lifecycle within wagmi
  • TypeScript Support: Full TypeScript support with proper type definitions

📚 Examples

For complete examples and integration patterns, check out the Air Kit documentation and the wagmi documentation.

Live Example

🔗 Related