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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@pioneer-platform/maya-network

v8.13.19

Published

MayaChain network integration using ShapeShift Unchained API.

Readme

MayaChain Network Module

MayaChain network integration using ShapeShift Unchained API.

Architecture

This module has been migrated from direct MayaChain node calls to use the Unchained API for better reliability and reduced node connection errors.

API Endpoints

Primary: ShapeShift Unchained API

  • Base URL: https://api.mayachain.shapeshift.com
  • Documentation: https://api.mayachain.shapeshift.com/swagger
  • Provides: Account info, balances, transaction history, broadcasting

Fallback: Midgard API

  • Base URL: https://midgard.mayachain.info/v2
  • Provides: Pool data, aggregated chain statistics
  • Used for: Pool queries not available in Unchained

Features

✅ Implemented via Unchained

  • getInfo() - Network information
  • getAccount(address) - Account details with balances
  • getBalance(address) - Single CACAO balance
  • getBalances(address) - All asset balances
  • txs(address, cursor, pageSize) - Paginated transaction history
  • broadcast(rawTx) - Transaction broadcasting

✅ Implemented via Midgard

  • getPools() - All liquidity pools
  • getPool(poolId) - Specific pool details

⚠️ Not Available in Unchained

  • getTransaction(txid) - Direct tx lookup (use account txs instead)
  • getPoolAddress() - Inbound addresses (requires node access)

Usage

const network = require('@pioneer-platform/mayachain-network')

// Get network info
const info = await network.info()

// Get account balances
const balances = await network.getBalances('maya1...')

// Get transaction history (paginated)
const txs = await network.txs('maya1...', undefined, 50)

// Broadcast transaction
const result = await network.broadcast(signedTxBase64)

Balance Formats

The module returns balances in standardized format:

[
  {
    denom: 'cacao',          // Asset denomination
    amountBase: '25029714637', // Raw amount (base units)
    amount: 25.029714637,    // Decimal amount
    decimals: 10             // Decimal places
  },
  {
    denom: 'maya',
    amountBase: '4104',
    amount: 0.4104,
    decimals: 4
  }
]

Decimal Places

  • CACAO: 10 decimals (1 CACAO = 10,000,000,000 base units)
  • MAYA: 4 decimals (1 MAYA = 10,000 base units)

Error Handling

The module uses minimal logging with retry logic:

  • 2 retries on 503 errors with exponential backoff
  • Logs only errors and key operations (no verbose stack traces)
  • Returns structured error responses for broadcast failures

Migration Notes

Changes from Previous Version

  1. ✅ Removed direct node calls to mayanode.mayachain.info
  2. ✅ Removed verbose error logging (no more giant stack traces)
  3. ✅ Uses Unchained API for account/balance/tx operations
  4. ✅ Keeps Midgard for pool data (not in Unchained)
  5. ✅ Simplified retry logic with minimal logging

Benefits

  • Reliability: Unchained API is more stable than direct node access
  • Performance: Faster responses, better caching
  • Cleaner logs: No more 503 spam in logs
  • Maintainability: Single API contract vs multiple node endpoints

Testing

cd modules/coins/mayachain/mayachain-network
bun run test

Test coverage:

  • ✅ Network info retrieval
  • ✅ Account balance queries
  • ✅ Multi-asset balance parsing
  • ✅ Transaction history (paginated)
  • ✅ Pool data from Midgard
  • 💬 Broadcasting (commented out - needs real signed tx)

Development

# Build
bun run build

# Test
bun run test

# Install dependencies
bun install

Dependencies

  • axios - HTTP client
  • axios-retry - Retry logic for 503 errors
  • @pioneer-platform/loggerdog - Logging

License

MIT