Sign In

@asterpay-io/solana

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asterpay-io/solana

AsterPay Solana integration - USDC payments on Solana for AI agents and DePIN

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

@asterpay/solana

Solana USDC payments for AI agents and DePIN infrastructure

npm TypeScript

Overview

@asterpay/solana provides USDC payment capabilities on Solana:

  • Fast transfers - Sub-second finality
  • Low fees - ~$0.00025 per transaction
  • DePIN support - Batch payouts for node operators
  • AI agent ready - Programmatic payments

Installation

npm install @asterpay/solana
# or
yarn add @asterpay/solana

Quick Start

Basic USDC Transfer

import { SolanaWallet, SolanaPaymentClient } from '@asterpay/solana';

// Create wallet
const wallet = new SolanaWallet({
  privateKey: process.env.SOLANA_PRIVATE_KEY!,
  network: 'mainnet-beta'
});

// Create payment client
const client = new SolanaPaymentClient(wallet);

// Send USDC
const result = await client.sendUSDC({
  recipient: 'RecipientPublicKey...',
  amount: 10.00,
  memo: 'Payment for API access'
});

console.log(`TX: ${result.signature}`);
console.log(`Explorer: ${result.explorerUrl}`);

DePIN Batch Payouts

import { SolanaWallet, DePINPayoutClient } from '@asterpay/solana';

const wallet = new SolanaWallet({
  privateKey: process.env.SOLANA_KEY!,
  network: 'mainnet-beta'
});

const payout = new DePINPayoutClient(wallet);

// Pay multiple node operators
const operators = [
  { address: 'operator1...', amount: 5.50, id: 'node-001' },
  { address: 'operator2...', amount: 3.25, id: 'node-002' },
  { address: 'operator3...', amount: 8.00, id: 'node-003' },
  // ... up to thousands of recipients
];

const result = await payout.batchPayout(operators, {
  concurrency: 10,      // Parallel transactions
  retryFailed: true,    // Retry failures
  maxRetries: 3         // Max retry attempts
});

console.log(`Paid: ${result.successful}/${result.total}`);
console.log(`Total: $${result.totalPaid}`);
console.log(payout.generatePayoutReport(result));

Check Balance

const wallet = new SolanaWallet({
  privateKey: process.env.SOLANA_KEY!,
  network: 'mainnet-beta'
});

const balance = await wallet.getBalance();
console.log(`SOL: ${balance.sol}`);
console.log(`USDC: ${balance.usdc}`);

Networks

NetworkUse CaseUSDC Address
mainnet-betaProductionEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
devnetDevelopment4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU
testnetTesting4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU

DePIN Use Cases

Node Operator Rewards

// Daily rewards distribution
const rewards = await fetchDailyRewards(); // Your reward calculation
const payout = new DePINPayoutClient(wallet);

const result = await payout.batchPayout(rewards, {
  concurrency: 20,  // Higher concurrency for speed
});

// Generate report for records
const report = payout.generatePayoutReport(result);
await savePayoutReport(report);

Epoch-Based Payouts

// Pay rewards at end of epoch
async function processEpochRewards(epochNumber: number) {
  const operators = await getEpochRewards(epochNumber);
  
  // Validate before payout
  const { valid, invalid } = await payout.validateRecipients(operators);
  
  if (invalid.length > 0) {
    console.warn(`${invalid.length} invalid recipients skipped`);
  }
  
  // Process valid recipients
  const result = await payout.batchPayout(valid);
  
  return {
    epoch: epochNumber,
    ...result
  };
}

Fee Estimates

OperationEst. Fee (SOL)Est. Fee (USD)
Single transfer0.000005$0.0005
With token account creation0.002$0.20
Batch (1000 recipients)~1.0~$100

API Reference

SolanaWallet

new SolanaWallet({
  privateKey: string | Uint8Array,  // Base58 or byte array
  network?: 'mainnet-beta' | 'devnet' | 'testnet',
  rpcUrl?: string,  // Custom RPC endpoint
  name?: string     // Wallet identifier
})

SolanaPaymentClient

const client = new SolanaPaymentClient(wallet);

await client.sendUSDC({
  recipient: string,    // Recipient address
  amount: number,       // Amount in USD
  memo?: string,        // Optional memo
  priorityFee?: number  // Priority fee (micro-lamports)
});

DePINPayoutClient

const payout = new DePINPayoutClient(wallet);

await payout.batchPayout(recipients, {
  concurrency?: number,        // Parallel transactions (default: 5)
  retryFailed?: boolean,       // Retry failures (default: true)
  maxRetries?: number,         // Max retries (default: 3)
  retryDelay?: number,         // Delay between retries (ms)
  createTokenAccounts?: boolean // Create accounts if missing
});

Security

  • Never expose private keys in code
  • Use environment variables for keys
  • Test on devnet before mainnet
  • Set transaction limits for automated systems

License

MIT License - see LICENSE

Keywords

asterpay

FAQs

Package last updated on 27 Jan 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts