Skip to content

skalenetwork/faremeter-plugin

Repository files navigation

@skalenetwork/faremeter-plugin

A faremeter plugin for SKALE Network. Provides encrypted and confidential token payment handlers for the x402 protocol on SKALE chains.

This is a plugin for faremeter, not a standalone library. It extends faremeter's infrastructure with SKALE-specific payment capabilities.

Quick Start

Client

import { wrap } from '@faremeter/fetch';
import { skale } from '@skalenetwork/faremeter-plugin/client';
import { skaleBaseMainnet } from '@skalenetwork/faremeter-plugin';

const handler = skale.charge({
  walletClient,
  publicClient,
  account,
  chain: skaleBaseMainnet,
});

const paidFetch = wrap(globalThis.fetch, { handlers: [handler] });

Server

import { middleware } from '@faremeter/middleware';
import { createFacilitatorHandler, skaleBaseMainnet } from '@skalenetwork/faremeter-plugin/server';

const handler = await createFacilitatorHandler(
  skaleBaseMainnet,
  process.env.SERVER_PRIVATE_KEY,
  'USDC.e'
);

app.use(middleware({ x402Handlers: [handler] }));

Documentation

See AGENTS.md for full documentation and examples/ for code samples.

Installation

npm install @skalenetwork/faremeter-plugin
# or
bun install @skalenetwork/faremeter-plugin

License

MIT © SKALE Labs

About

SKALE Network Faremeter Plugin

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors