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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@uxly/1shot-client

v1.3.2

Published

TypeScript client for the 1Shot API

Readme

@uxly/1shot-client

This is a TypeScript client SDK for 1Shot. It provides both a strongly typed REST client and a utility method for verifying webhook signatures.

Installation

npm install @uxly/1shot-client

Usage

REST Client

import { OneShotClient } from '@uxly/1shot-client';

// Initialize the client
const client = new OneShotClient({
  apiKey: 'your_api_key',
  apiSecret: 'your_api_secret',
  baseUrl: 'https://api.1shotapi.com/v1' // Optional, defaults to this URL
});

// List contractMethods for a business
const contractMethods = await client.contractMethods.list({
  businessId: 'your_business_id',
  params: { page: 1, pageSize: 10 }
});

// Execute a Contract Method
const transaction = await client.contractMethods.execute({
  contractMethodId: 'your_contract_method_id',
  params: {
    amount: '1000000000000000000', // 1 ETH in wei
    recipient: '0x123...'
  }
});

// Get Contract Method details
const contractMethod = await client.contractMethods.get('your_contract_method_id');

// Create a new transaction
const newContractMethod = await client.contractMethods.create({
  businessId: 'your_business_id',
  params: {
    name: 'Transfer ETH',
    description: 'Transfer ETH to a recipient',
    chainId: 1, // Ethereum mainnet
    contractAddress: '0x...',
    functionName: 'transfer',
    stateMutability: 'nonpayable',
    inputs: [
      {
        name: 'recipient',
        type: 'address'
      },
      {
        name: 'amount',
        type: 'uint256'
      }
    ]
  }
});

Webhook Verification

Using the Standalone Function

import { verifyWebhook } from '@uxly/1shot-client';
import express from 'express';

const app = express();
app.use(express.json());

app.post('/webhook', async (req, res) => {
  // Get the webhook body and signature
  const body = req.body;
  const signature = body.signature;
  delete body.signature;
  
  if (!signature) {
    return res.status(400).json({ error: 'Signature missing' });
  }
  
  // Your webhook public key
  const publicKey = 'your_webhook_public_key';
  
  try {
    // Verify the webhook signature
    const isValid = verifyWebhook({
      body,
      signature,
      publicKey
    });
    
    if (!isValid) {
      return res.status(403).json({ error: 'Invalid signature' });
    }
    
    return res.json({ message: 'Webhook verified successfully' });
    
  } catch (error) {
    return res.status(403).json({ error: error.message });
  }
});

Error Handling

The client throws errors for various conditions:

  • RequestError for HTTP request failures
  • ValidationError for invalid parameters
  • InvalidSignatureError for invalid webhook signatures

Type Safety

The client includes comprehensive TypeScript types for better IDE support and type checking. All models and responses are properly typed using TypeScript interfaces.

Publishing

This package is published to npm using modern Node.js packaging tools. Here's how to publish a new version:

  1. Update the version in package.json:
{
  "version": "0.1.0"  // Update this to your new version
}
  1. Build the package:
npm run build
  1. Test the build:
npm pack
npm install ./uxly-1shot-client-0.1.0.tgz
  1. Publish to npm:
npm publish

Note: You'll need to have an npm account and be logged in. You can log in using:

npm login

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.