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

@supaverse/stellar-nest

v1.0.1

Published

An opinionated toolkit for seamless integration of Stellar with NestJS.

Readme

@supaverse/stellar-nest


🚀 Installation

npm install @supaverse/stellar-nest

This package is available via npm.


🧪 Usage with NestJS

import { Module } from '@nestjs/common';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { StellarModule } from '@supaverse/stellar-nest';

@Module({
  imports: [
    ConfigModule.forRoot(),
    StellarModule.forRootAsync({
      imports: [ConfigModule],
      inject: [ConfigService],
      useFactory: (config: ConfigService) => {
        const env = config.get<'prod' | 'dev'>('app.environment');
        const stellar = config.get<IStellarConfig>('stellar');

        return {
          payments: {
            config: {
              create_by: 'ACCOUNT',
              pay_by: 'ACCOUNT',
              sponsor_by: 'ACCOUNT',
            },
          },
          account: {
            config: {
              create_by: 'ACCOUNT',
              starting: {
                homeDomain: 'supaverse.tech',
                balance: '1.5',
              },
            },
            accounts: [
              {
                public: stellar.master_account,
                type: 'ACCOUNT',
                secret: stellar.master_account_secret,
              },
            ],
          },
          mode: env === 'prod' ? 'PUBLIC' : 'TESTNET',
        };
      },
    }),
  ],
})
export class AppModule {}

🧩 Configuration examples

🔹 1. Simple configuration (one account does everything)

StellarModule.forRootAsync({
  imports: [ConfigModule],
  inject: [ConfigService],
  useFactory: (config: ConfigService) => {
    const env = config.get<'prod' | 'dev'>('app.environment');
    const stellar = config.get<IStellarConfig>('stellar');

    return {
      payments: {
        config: {
          create_by: 'ACCOUNT',
          pay_by: 'ACCOUNT',
          sponsor_by: 'ACCOUNT',
        },
      },
      account: {
        config: {
          create_by: 'ACCOUNT',
          starting: {
            homeDomain: 'supaverse.tech',
            balance: '1.5',
          },
        },
        accounts: [
          {
            public: stellar.master_account,
            type: 'ACCOUNT',
            secret: stellar.master_account_secret,
          },
        ],
      },
      mode: env === 'prod' ? 'PUBLIC' : 'TESTNET',
    };
  },
});

🔹 2. Advanced configuration (multiple roles and signers)

StellarModule.forRootAsync({
  imports: [ConfigModule],
  inject: [ConfigService],
  useFactory: (config: ConfigService) => {
    return {
      payments: {
        config: {
          create_by: 'ISSUER',
          pay_by: 'DISTRIBUTOR',
          sponsor_by: 'DISTRIBUTOR',
        },
      },
      account: {
        config: {
          create_by: 'DISTRIBUTOR',
          starting: {
            homeDomain: 'nauta.land',
            balance: '2',
            baseTrustline: [
              process.env.ENVIROMENT === 'prod' ? USDC.PUBLIC : USDC.TESTNET,
            ],
          },
        },
        accounts: [
          {
            public: config.get('STELLAR_ISSUER_PUBLIC'),
            type: 'ISSUER',
            signers: ['APP_SIGNER'],
          },
          {
            public: config.get('STELLAR_DISTRIBUTOR_PUBLIC'),
            type: 'DISTRIBUTOR',
            signers: ['APP_SIGNER'],
          },
          {
            secret: config.get('STELLAR_SECRET'),
            type: 'APP_SIGNER',
          },
        ],
      },
      mode: process.env.ENVIROMENT === 'prod' ? 'PUBLIC' : 'TESTNET',
    };
  },
});

💡 Note: The type field in each account is a user-defined alias.
You can use any string to identify the role or purpose of that account (e.g., ISSUER, DISTRIBUTOR, APP_SIGNER, ACCOUNT).
These aliases are used internally to define who performs actions like payment, sponsorship, or account creation.


🛠️ Additional Utilities

The module includes helpful utility methods and decorators for account handling, validation, and testing.

🔹 AccountService

  • createAccount()
    Creates an account using the default configuration provided in the module setup.

  • getAccount(accountId: string)
    Checks if the account ID is valid and returns the account from the Stellar network.

  • getBalances(accountId: string, assetCode?: string)
    Returns the list of balances for an account. You can filter by asset code (e.g., XLM, USDC).

  • getPairFromSecret(secret: string)
    Returns a Keypair instance from a given secret. Throws an error if invalid.

  • getAccountFromSecret(secret: string)
    Returns a tuple [Keypair, AccountResponse] for a given secret key.

  • validateMemo(memo)
    Returns a valid Stellar Memo object based on the input type: string, number, or Uint8Array.

  • validateAssetBalance(accountId: string, asset: Asset, amount: number)
    Checks if the account has at least the specified amount of the given asset.

  • validateTransaction(transactionId: string)
    Checks if the given transaction ID was successful on the Stellar network.


🎯 Decorators

These decorators simplify access to Stellar objects inside controller methods.

  • @BalanceParam(name, options?)
    Injects a balance object from the request. Supports asset filtering.

  • @AccountParam(name, options?)
    Injects an account object parsed from the request based on the given parameter name.

  • @CreateKeyPair()
    Generates and injects a new random Keypair.

  • @CreateTestAccount()
    Generates a funded testnet account using Stellar Friendbot (for development only).


⚠️ Disclaimer

This package is still under active development.
It can be used in production environments at your own risk — please validate its behavior and fit with your use case before relying on it.

Feedback and pull requests are welcome!


📄 License

MIT — © Supaverse Tech