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

unisat-api

v1.2.0

Published

Unisat API Client

Downloads

6

Readme

UniSat API Client 🚀

中文文档 NPM version License Downloads Last Commit Contributors

🌟 UniSat API Client is an open-source TypeScript/JavaScript client library based on the UniSat API. It provides a simple and easy-to-use interface to interact with various services of UniSat, including blockchain queries, transactions, inscriptions, BRC-20 tokens, and more.

✨ Features

  • 💼 Complete encapsulation of all UniSat API functions
  • 📦 Supports TypeScript with type definitions
  • 🌐 Easy-to-use Promise-based interface
  • ⚙️ Built-in request rate limiting and error handling
  • 🔧 Supports custom configurations (network, base URL, etc.)

📦 Installation

Using npm:

npm install unisat-api

Or using yarn:

yarn add unisat-api

🚀 Quick Start

import UnisatApiClient from 'unisat-api';
const client = new UnisatApiClient({
  apikey: 'YOUR_API_KEY',
  network: 'mainnet'
});

// 🔍 Get blockchain information
client.blocks.getBlockchainInfo().then(info => {
  console.log(info);
});

// 💰 Get address balance
client.address.getAddressBalance('bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh').then(balance => {
  console.log(balance);
});

🛠️ API Overview

The UniSat API client provides the following main modules:

  • 🪙 runes: Runes-related operations
  • 📈 market: Market data queries
  • 🧱 blocks: Blockchain information queries
  • 🔄 brc20swap: BRC-20 token swaps
  • 🏦 address: Address-related operations
  • 🖋️ inscription: Inscription operations
  • 📜 inscriptions: Inscription queries
  • 💸 transaction: Transaction-related operations

Each module contains multiple methods for interacting with the corresponding UniSat API endpoints.

📖 Documentation

For detailed explanations of each module and method, please refer to our API Documentation.

⚙️ Configuration Options

When creating an instance of UnisatApiClient, you can pass the following configuration options:

  • apikey: Your UniSat API key (required)
  • network: The network to connect to ('mainnet' or 'testnet', default is 'mainnet')
  • baseURL: Custom API base URL (optional)

⚠️ Error Handling

All API methods return a Promise. It is recommended to use a try/catch block or the .catch() method to handle any potential errors.

try {
  const balance = await client.address.getAddressBalance('bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh');
  console.log(balance);
} catch (error) {
  console.error('Error fetching balance:', error);
}

🙌 Contribution Guidelines

We welcome and appreciate all forms of contributions. If you'd like to contribute to the project, please follow these steps:

  1. 🍴 Fork the repository
  2. 🌿 Create your feature branch (git checkout -b feature/AmazingFeature)
  3. 💻 Commit your changes (git commit -m 'Add some AmazingFeature')
  4. 🚀 Push to the branch (git push origin feature/AmazingFeature)
  5. 🎉 Open a Pull Request

Before submitting a Pull Request, please ensure your code adheres to our coding standards and passes all tests.

📄 License

This project is licensed under the MIT License. For more details, please see the LICENSE file.

🔗 Related Links

📬 Contact Us

If you have any questions or suggestions, please contact us through:

Thank you for using the UniSat API Client! 🚀