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

@finaegis/sdk

v1.0.4

Published

Official FinAegis JavaScript/TypeScript SDK for the FinAegis API

Readme

FinAegis JavaScript/TypeScript SDK

Official JavaScript/TypeScript SDK for the FinAegis API.

Installation

npm install @finaegis/sdk
# or
yarn add @finaegis/sdk

Quick Start

import { FinAegis } from '@finaegis/sdk';

// Initialize the client
const client = new FinAegis({
  apiKey: 'your-api-key',
  environment: 'sandbox' // or 'production'
});

// List accounts
const accounts = await client.accounts.list();

// Create a new account
const account = await client.accounts.create({
  user_uuid: 'user-uuid',
  name: 'My Savings Account',
  initial_balance: 10000 // in cents
});

// Make a transfer
const transfer = await client.transfers.create({
  from_account: 'account-uuid-1',
  to_account: 'account-uuid-2',
  amount: 5000, // in cents
  asset_code: 'USD',
  reference: 'Payment for services'
});

Configuration

const client = new FinAegis({
  apiKey: 'your-api-key',
  environment: 'production', // 'production' | 'sandbox' | 'local'
  timeout: 30000, // Request timeout in milliseconds
  maxRetries: 3 // Number of retries for failed requests
});

Resources

Accounts

// List all accounts
const accounts = await client.accounts.list({
  page: 1,
  per_page: 20
});

// Get account details
const account = await client.accounts.get('account-uuid');

// Get account balances
const balances = await client.accounts.getBalances('account-uuid');

// Deposit funds
const deposit = await client.accounts.deposit('account-uuid', 10000, 'USD');

// Withdraw funds
const withdrawal = await client.accounts.withdraw('account-uuid', 5000, 'USD');

// Freeze/unfreeze account
await client.accounts.freeze('account-uuid', 'Suspicious activity');
await client.accounts.unfreeze('account-uuid', 'Investigation completed');

Transfers

// Create a transfer
const transfer = await client.transfers.create({
  from_account: 'account-uuid-1',
  to_account: 'account-uuid-2',
  amount: 10000,
  asset_code: 'USD',
  reference: 'Invoice #123'
});

// Get transfer details
const transferDetails = await client.transfers.get('transfer-uuid');

Exchange Rates

// Get exchange rate
const rate = await client.exchangeRates.get('USD', 'EUR');

// Convert currency
const conversion = await client.exchangeRates.convert('USD', 'EUR', 100);

GCU (Global Currency Unit)

// Get GCU composition
const composition = await client.gcu.getComposition();

// Get value history
const history = await client.gcu.getValueHistory({
  period: '7d',
  interval: 'daily'
});

// Get active governance polls
const polls = await client.gcu.getActivePolls();

Webhooks

// Create a webhook
const webhook = await client.webhooks.create({
  name: 'Transaction Updates',
  url: 'https://your-app.com/webhooks',
  events: ['transaction.created', 'transaction.completed'],
  secret: 'your-webhook-secret'
});

// List webhook deliveries
const deliveries = await client.webhooks.getDeliveries('webhook-uuid');

Error Handling

import { FinAegisError } from '@finaegis/sdk';

try {
  const account = await client.accounts.get('invalid-uuid');
} catch (error) {
  if (error instanceof FinAegisError) {
    console.error('API Error:', error.message);
    console.error('Status Code:', error.statusCode);
    
    if (error.isNotFoundError()) {
      // Handle 404 errors
    } else if (error.isAuthError()) {
      // Handle authentication errors
    } else if (error.isValidationError()) {
      // Handle validation errors
      console.error('Validation errors:', error.data);
    }
  }
}

TypeScript Support

This SDK is written in TypeScript and provides full type definitions for all API responses.

import { Account, Transfer, CreateAccountParams } from '@finaegis/sdk';

// All types are available for import
const createAccount = async (params: CreateAccountParams): Promise<Account> => {
  const response = await client.accounts.create(params);
  return response.data;
};

Advanced Usage

Custom Requests

// Make custom API requests
const customResponse = await client.request({
  method: 'GET',
  path: '/custom-endpoint',
  params: { key: 'value' }
});

Webhook Signature Verification

import crypto from 'crypto';

function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean {
  const expectedSignature = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  
  return crypto.timingSafeEqual(
    Buffer.from(signature),
    Buffer.from(expectedSignature)
  );
}

Examples

Complete Payment Flow

async function processPayment(fromAccountId: string, toAccountId: string, amount: number) {
  try {
    // Check sender balance
    const balances = await client.accounts.getBalances(fromAccountId);
    const usdBalance = balances.data.balances.find(b => b.asset_code === 'USD');
    
    if (!usdBalance || parseFloat(usdBalance.available_balance) < amount) {
      throw new Error('Insufficient balance');
    }
    
    // Create transfer
    const transfer = await client.transfers.create({
      from_account: fromAccountId,
      to_account: toAccountId,
      amount: amount * 100, // Convert to cents
      asset_code: 'USD',
      reference: `Payment on ${new Date().toISOString()}`
    });
    
    console.log('Transfer completed:', transfer.data.uuid);
    return transfer.data;
  } catch (error) {
    console.error('Payment failed:', error);
    throw error;
  }
}

License

MIT