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

@wuwei-labs/srsly

v3.0.0-beta.19

Published

TypeScript SDK for SRSLY

Readme

@wuwei-labs/srsly

Simplified TypeScript SDK for SRSLY

Status: 🚧 Beta - Under active development

What is this?

This is a simplified TypeScript SDK for SRSLY. It's a thin convenience wrapper around Codama-generated TypeScript clients, focusing on simplicity and maintainability.

Key Differences from @wuwei-labs/srsly

Simpler (80% less code)

  • Old: 4,000+ lines of custom abstractions
  • New: ~800 lines of thin wrappers

Clearer Purpose

  • Old: Framework with fluent APIs, factories, builders
  • New: Convenience wrapper around Codama

Easier Configuration

  • Old: Fluent selectors, chainable configs, network modules
  • New: Simple global config + optional overrides

Better Maintenance

  • Old: Complex abstractions break when Codama updates
  • New: Thin wrappers adapt easily to Codama changes

Installation

pnpm add @wuwei-labs/srsly

Quick Start

With @solana/kit (default)

import { setSdkConfig, createContract } from '@wuwei-labs/srsly';

// Set global config once
setSdkConfig({ network: 'atlasnet' });

// Create a contract - returns @solana/kit instruction
const instruction = await createContract({
  owner: walletAddress,  // string address
  fleet: fleetAddress,
  ownerProfile: profileAddress,
  gameId: gameAddress,
  rate: 100, // 100 ATLAS per payment
  durationMax: { days: 30 },
  paymentsFreq: '@daily'
});

With @solana/web3.js

import { PublicKey } from '@solana/web3.js';
import { setSdkConfig, createContract } from '@wuwei-labs/srsly';

// Set global config with PublicKey constructor
setSdkConfig({
  network: 'mainnet-beta',
  PublicKey // Enable web3.js mode
});

// Create a contract - returns web3.js TransactionInstruction
const instruction = await createContract({
  owner: keypair,  // Accepts web3.js Keypair
  fleet: fleetPubkey,  // Accepts web3.js PublicKey
  ownerProfile: profilePubkey,
  gameId: gamePubkey,
  rate: 100,
  durationMax: { days: 30 },
  paymentsFreq: '@daily'
});

// instruction.keys[0].pubkey is a PublicKey instance

Configuration

Basic Configuration

import { setSdkConfig, getSdkConfig, clearSdkConfig } from '@wuwei-labs/srsly';

// Set global config
setSdkConfig({
  network: 'atlasnet' | 'mainnet-beta' | 'localnet',
  rpcUrl: 'https://custom-rpc.com',  // Optional
  programId: 'custom-program-id',     // Optional
  commitment: 'confirmed',             // Optional
  PublicKey: PublicKey                 // Optional for web3.js mode
});

// Get current config
const config = getSdkConfig();

// Clear config (reset to defaults)
clearSdkConfig();

// Override per-call
const ix = await createContract(params, {
  rpcUrl: 'https://temporary-rpc.com'
});

Network Addresses

The SDK provides centralized address management for different networks:

import { getAddresses, ATLASNET_ADDRESSES, MAINNET_ADDRESSES } from '@wuwei-labs/srsly';

// Get addresses for current network (from global config)
const addresses = getAddresses();
console.log(addresses.atlasMint);  // ATLAS token mint
console.log(addresses.sage);       // SAGE program
console.log(addresses.srsly);      // SRSLY program

// Override for specific network
const mainnetAddrs = getAddresses({ network: 'mainnet-beta' });

// Custom SRSLY program
const customAddrs = getAddresses({ programId: 'MyCustomSRSLY...' });
console.log(customAddrs.srsly); // 'MyCustomSRSLY...'

// Direct access to network addresses
console.log(ATLASNET_ADDRESSES);  // All atlasnet addresses
console.log(MAINNET_ADDRESSES);   // All mainnet addresses

Available Networks:

  • 'atlasnet' - Star Atlas testnet (default)
  • 'mainnet-beta' - Solana mainnet / Star Atlas production
  • 'localnet' - Local development

Network Addresses:

  • srsly - SRSLY rental program
  • sage - Star Atlas SAGE program
  • atlasMint - ATLAS token mint
  • profileFaction - Profile Faction program
  • gameId - Star Atlas game ID

## API Reference

### Instructions

- `createContract(params, config?)` - Create a rental contract
- `closeContract(params, config?)` - Close a rental contract
- `acceptRental(params, config?)` - Accept a rental
- `cancelRental(params, config?)` - Cancel a rental
- _(More to come)_

### Parameters

All instruction params accept:

- **Signers**: String addresses, web3.js Keypairs, or @solana/kit signers
- **Addresses**: String addresses or web3.js PublicKeys
- **Rates**: Numbers (ATLAS) or objects `{ atlas: 1.5 }` or `{ stardust: 150_000_000 }`
- **Durations**: Objects `{ days: 7 }`, `{ hours: 24 }`, `{ weeks: 2 }`, etc.
- **Schedules**: Strings `'@daily'`, `'@hourly'`, or cron expressions

### Return Types

- **Without PublicKey in config**: Returns @solana/kit instruction
- **With PublicKey in config**: Returns web3.js TransactionInstruction

### Discount Authorization

The SDK provides a `createDiscount` helper for server-side discount authorization. This is useful when an affiliate wants to offer discounts to borrowers.

#### Server-side

```typescript
import { setSdkConfig, createDiscount } from '@wuwei-labs/srsly';

// Can be set once globally (e.g., at app startup)
setSdkConfig({ rpcUrl: 'https://your-rpc-url.com' });

const discountAuth = await createDiscount({
  address: 'AFFILIATE_MEMBER_PDA',
  discount: 10,                         // 10% discount
  expirySlots: 1000,                    // ~6-7 minutes from now
  discountAuthority: serverKeypair,
});

// Already JSON-safe - return directly via API
return discountAuth;

Client-side

import { acceptRental } from '@wuwei-labs/srsly';

// Pass directly from server response - no deserialization needed
const ix = await acceptRental({
  borrower: wallet,
  contract: contractAddress,
  duration: { days: 7 },
  discountAuth: response.discountAuth,
  referrer: affiliateMemberAddress,
});

Development Status

  • ✅ Core config system
  • ✅ Centralized address management
  • ✅ Signer handling (web3.js + kit)
  • ✅ web3.js conversion
  • ✅ Parameter converters (amount, duration, schedule)
  • ✅ First instruction: createContract
  • 🚧 Additional contract instructions
  • 🚧 Rental instructions
  • 🚧 Other instructions
  • 🚧 Tests

Migration from @wuwei-labs/srsly

Coming soon - see migration guide once this package reaches 1.0.0.

Contributing

This package is currently in beta. Please report issues on GitHub.

License

ISC