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

@venturialstd/bitso

v0.0.6

Published

Bitso API Integration Module for Venturial

Readme

@venturialstd/bitso

A comprehensive NestJS SDK for Bitso API v3, developed by Venturial, that provides full integration with Bitso's exchange and withdrawal infrastructure. This module enables currency conversions, crypto swaps, fiat withdrawals (CLABE, debit card), and crypto withdrawals, along with webhook support for funding and withdrawal events.


Features

  • Currency Conversions: Get quotes and conversion rates for fiat and crypto pairs (MXN, USD, USDC, USDT, BTC, ETH)
  • Exchange/Swap: Execute currency swaps between supported pairs
  • Fiat Withdrawals: Withdraw MXN via CLABE (SPEI) or debit card
  • Crypto Withdrawals: Withdraw crypto to external addresses
  • Webhook Integration: Receive real-time notifications for funding and withdrawal events
  • HMAC-SHA256 Authentication: Secure API request signing
  • Environment Support: Staging and production environments
  • Type Safety: Full TypeScript support with comprehensive type definitions

Installation

npm install @venturialstd/bitso
# or
yarn add @venturialstd/bitso

Peer Dependencies

This package requires the following peer dependencies:

npm install @nestjs/common@^11.0.11 @nestjs/core@^11.0.5 @nestjs/axios@^4.0.0 @venturialstd/core@^1.0.16 crypto-js@^4.2.0

Basic Usage

1. Import the Module

import { Module } from '@nestjs/common';
import { BitsoModule } from '@venturialstd/bitso';

@Module({
  imports: [
    BitsoModule,
  ],
})
export class AppModule {}

2. Inject and Use Services

import { Injectable } from '@nestjs/common';
import { BitsoExchangeService, BitsoWithdrawService } from '@venturialstd/bitso';

@Injectable()
export class PaymentService {
  constructor(
    private readonly bitsoExchangeService: BitsoExchangeService,
    private readonly bitsoWithdrawService: BitsoWithdrawService,
  ) {}

  async getQuote(fromCurrency: string, toCurrency: string, amount: string) {
    const quote = await this.bitsoExchangeService.getQuote(
      fromCurrency.toLowerCase(),
      toCurrency.toLowerCase(),
      amount,
    );
    return quote; // { rate, toAmount }
  }

  async withdrawToClabe(amount: string, clabe: string, beneficiary: string) {
    const withdrawal = await this.bitsoWithdrawService.withdrawClabe(
      amount,
      clabe,
      beneficiary,
      'Payment concept',
    );
    return withdrawal;
  }
}

3. Configuration

The module uses SettingsService from @venturialstd/core to retrieve credentials. Configure the following settings:

  • GLOBAL:BITSO:GENERAL:ENVIRONMENT: Environment (STAGING or PRODUCTION)
  • GLOBAL:BITSO:GENERAL:API_KEY: Your Bitso API key
  • GLOBAL:BITSO:GENERAL:API_SECRET: Your Bitso API secret

Settings can be stored in the database or via the admin settings UI. The module loads settings from @venturialstd/core SettingsService.


API

BitsoClient

Low-level client for Bitso API. Uses HMAC-SHA256 for request signing.

| Method | Description | |--------|-------------| | getCurrencyWalletPublicKey(currency) | Get wallet public key for a currency | | getCurrencyConversionRate(fromCurrency, toCurrency, spendAmount) | Get conversion rate (returns number) | | getCurrencyQuote(fromCurrency, toCurrency, spendAmount) | Get quote with rate and converted amount | | swapBetweenCurrency(fromCurrency, toCurrency, spendAmount) | Execute a currency swap | | sendWithdrawalFiatClabe(amount, clabe, beneficiary, concept?) | Withdraw MXN via CLABE (SPEI) | | sendWithdrawalFiatDebitCard(amount, debitCard, institutionCode, beneficiary, concept?) | Withdraw MXN via debit card | | sendWithdrawalCrypto(wireId, amount, address, currency, network) | Withdraw crypto to external address |

BitsoExchangeService

| Method | Description | |--------|-------------| | requestExchange(data: BitsoRequestExchange) | Create and execute an exchange, persisting to database | | getUsdToMxnRate() | Get USD to MXN conversion rate | | getConversionRate(fromCurrency, toCurrency, amount?) | Get conversion rate for a currency pair | | getQuote(fromCurrency, toCurrency, amount) | Get quote for dashboard/calculator (rate + toAmount) |

BitsoWithdrawService

| Method | Description | |--------|-------------| | withdrawClabe(amount, clabe, beneficiary, concept?) | Withdraw MXN to CLABE (SPEI) | | withdrawDebitCard(amount, debitCard, bankId, beneficiary, concept?) | Withdraw MXN to debit card | | updateById(id, data) | Update withdrawal record by ID |


Supported Currencies

Bitso uses lowercase currency codes. Supported pairs include:

  • Fiat: mxn, usd
  • Crypto: usdc, usdt, btc, eth

Webhooks

The module includes a webhook controller for Bitso events:

  • Funding: funding events (pending, complete)
  • Withdrawal: withdrawal events (pending, complete)

Configure your webhook URL in the Bitso dashboard to receive real-time notifications.


Error Handling

The module includes error handling that:

  • Logs errors via AppLogger from @venturialstd/core
  • Returns null for client methods when operations fail
  • Throws errors for service methods when operations fail (e.g., withdrawClabe)

Notes

  • Environment Support: The module supports STAGING (https://stage.bitso.com/api/v3) and PRODUCTION (https://bitso.com/api/v3).
  • Currency Format: All currency codes must be lowercase when calling Bitso API (mxn, usd, btc, etc.).
  • Authentication: HMAC-SHA256 signing is required for all requests. API Key and API Secret are stored as secrets.
  • Type Safety: All request and response types are fully typed for better IDE support.
  • Rate Limits: Be aware of Bitso's rate limits when making multiple API calls.
  • Quote Expiration: Currency conversion quotes may have expiration times. Execute swaps promptly after obtaining a quote.

License

MIT


Support

For issues, questions, or contributions, please contact the Venturial development team.