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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nftchance/plug-router

v0.0.0

Published

Primary backend router for Plug intents and packaged SDK for external use.

Downloads

2

Readme

🔌 Plug Router

[!NOTE] This repository is a submodule of the Plug monorepo that contains all the pieces of the Plug toolkit.

With the Plug Router, you can easily integrate your application with the Plug network. In a few lines of code, you can start receiving intent declarations permissioned to your solver, submit intents on the behalf of users (signers), simulate transaction routes, and more.

All of this has been made available through a simple SDK that is easy to use and consume so that you do not need to run any of the underlying infrastructure.

Getting an API Key

[!WARNING] This functionality is not publicly available yet. Please contact the team if you are interested in using the Plug Router or running a Solver.

Usage

Getting started with router consumption is as simple as installing the package and instantiating the SDK with your API key.

// Import the SDK from the built package.
import { createPlugSDK } from "@nftchance/plug-router"

// Create a validated instance of the SDK with your API key.
const plugSDK = createPlugSDK("YOUR_API_KEY")

Once you have the SDK, you can start using it to interact with the Plug network. There is intellisense support for all of the SDK methods and properties, so you can easily find what you are looking for.

[!NOTE] There is not currently an OpenAPI specification for the Plug Router. If you would like to submit a PR that adds one, please do so!

Development

For most, you should not need to install any system dependencies to run the application or utilize the SDK that is provided. However, if you are developing the application or server, you can find all the needed information to get started below.

Dependencies

To run @nftchance/plug-router it is necessary to install the following dependencies first:

├─ docker — "Pipeline to run containerized code processes."
└─ pnpm — "Efficient package manager for Node modules."

Configuration

nftchance/plug-router uses a default-loaded configuration file that is validated with the use of zod. All values can be overriden by setting values for each of the environment variables in your .env file.

[!TIP] It is recommended that you use Docker. If you have a Docker process running, you do not even need to manually create a new container or deal with the complexities. There is a built-in script that will create a new database and start the container for you.

You can override the default configuration of any value by setting it in your .env file. Due to the validate nature of the configuration, if you ever have an issue with your configuration, you will automatically receive a runtime error that is bubbled up when you try to start the application.

The full list of configuration options is as follows:

├─ VERSION — "The version of the router."
├─ DATABASE_URL — "The URL the database is running on."
├─ PORT — "The port of the router API."
├─ API_URL — "The URL of the router API."
├─ RATE_LIMIT_ALLOW_LIST — "The list of IP addresses that bypass rate limiting."
├─ RATE_LIMIT_WINDOW_MS — "The window in milliseconds that rate limiting is applied to."
├─ RATE_LIMIT — "The number of requests allowed in the rate limiting window."
├─ RATE_LIMIT_MESSAGE — "The message that is returned when rate limiting is exceeded."
├─ SIMULATOR_URL — "The URL of the simulator API that is used to simulate transactions."
├─ SIMULATOR_API_KEY — "The API key of the simulation API."
├─ CONTAINER_NAME — "The Docker container name hosting the PostgreSQL database."
├─ DATABASE_NAME — "The name of the PostgreSQL database."
├─ DATABASE_PORT — "The port of the PostgreSQL database."
└─ DATABASE_PASSWORD — "The password of the PostgreSQL database."