Developer SDK

Build with Modulr

Integrate wallet risk, token launch readiness, and smart contract auditing directly into your app. One SDK, no setup required.

GitHub
npm install @modulr/sdk

Quickstart

Install the SDK and start making calls in minutes. No API key required.

Install

npm install @modulr/sdk

TypeScript / Node.js

import { Modulr } from '@modulr/sdk'

const modulr = new Modulr()

// Wallet risk
const risk = await modulr.walletRisk.analyze('9apA5U8...')
console.log(risk.riskLevel, risk.riskScore)

// Token launch
const launch = await modulr.tokenLaunch.check({
  projectName: 'MyToken',
  chain: 'Solana',
  launchStage: 'Pre-launch',
})
console.log(launch.readinessScore, launch.riskFlags)

// Smart contract audit
const audit = await modulr.audit.scan({
  contractText: '// your contract code',
  language: 'Solidity',
  reviewDepth: 'Standard Review',
})
console.log(audit.riskLevel, audit.findings)

// AI agent generator
const agent = await modulr.agent.generate({
  agentName: 'Whale Tracker',
  agentType: 'Wallet Monitor',
  targetChain: 'Solana',
  framework: 'Vanilla TypeScript',
  description: 'Monitor a wallet for large SOL movements',
})
console.log(agent.scriptContent)

Modules

Each module maps directly to a Modulr tool.

Wallet Risk

Analyze any Solana wallet. Returns risk score, risk level, wallet type, warning signals, activity breakdown and full explainability.

Method

modulr.walletRisk.analyze(address)

Returns

{
  riskLevel: "Low Risk" | "Medium Risk" | "High Risk",
  riskScore: number,          // 0–100
  walletType: string,
  warningSignals: string[],
  positiveSignals: string[],
  scoreBreakdown: { ... },
  generatedAt: string
}
Token Launch

Generate a launch readiness report for any token project. Returns a readiness score, checklist sections, risk flags and next steps.

Method

modulr.tokenLaunch.check(input)

Returns

{
  readinessScore: number,     // 0–100
  readinessLevel: string,
  sections: ChecklistSection[],
  riskFlags: string[],
  nextSteps: string[],
  generatedAt: string
}
Smart Contract Audit

Static analysis on Solidity, Rust/Anchor or Move contracts. Returns findings by severity, a security checklist, and a deploy recommendation.

Method

modulr.audit.scan(input)

Returns

{
  riskLevel: string,
  riskScore: number,          // 0–100
  findings: AuditFinding[],
  securityChecklist: [...],
  deployRecommendation: string,
  suggestedFixes: string[],
  generatedAt: string
}
AI Agent Generator

Generate complete TypeScript agent scripts for trading, monitoring, alerts and DeFi automation.

Method

modulr.agent.generate(input)

Returns

{
  scriptContent: string,      // complete .ts file
  setupInstructions: string[],
  requiredEnvVars: string[],
  dependencies: string[],
  generatedAt: string
}
Token Website Generator

Generate a production-ready HTML token launch website with hero, tokenomics, roadmap and how-to-buy sections.

Method

modulr.tokenSite.generate(input)

Returns

{
  html: string,               // complete HTML file
                              // includes: hero, tokenomics,
                              // roadmap, how-to-buy sections
  generatedAt: string
}

Agent-Native Payments (x402)

All Modulr tools are available as x402-payable endpoints. AI agents pay in USDC on Solana with no API key, no signup, and no manual steps — the payment is negotiated and settled automatically on every request.

Facilitator: PayAINetwork: Solana MainnetAsset: USDCProtocol: x402 v2
POST/api/x402/wallet-risk$0.25 USDC

Wallet risk report

{ "address": "9apA5U8..." }
POST/api/x402/token-launch$0.50 USDC

Token launch checklist

{ "projectName": "MyToken", "chain": "Solana", "launchStage": "Pre-launch", ... }
POST/api/x402/smart-contract$1.00 USDC

Smart contract audit

{ "contractText": "...", "language": "Solidity", "reviewDepth": "Standard Review" }
POST/api/x402/agent$2.00 USDC

AI agent generator

{ "agentName": "...", "agentType": "Trading Bot", "targetChain": "Solana", "framework": "Vanilla TypeScript", "description": "..." }
POST/api/x402/token-site$3.00 USDC

Token website generator

{ "tokenName": "...", "ticker": "...", "contractAddress": "...", "description": "...", "tokenomics": "...", "roadmap": "..." }

x402 Quickstart — call any endpoint as an agent

Install: npm install @x402/fetch @x402/svm @solana/kit
import { x402Client, wrapFetchWithPayment } from "@x402/fetch";
import { registerExactSvmScheme } from "@x402/svm/exact/client";
import { createKeyPairSignerFromBytes } from "@solana/kit";
import { base58 } from "@scure/base";

// Create a signer from your Solana private key
const svmSigner = await createKeyPairSignerFromBytes(
  base58.decode(process.env.SOLANA_PRIVATE_KEY)
);

// Wrap fetch — payment is handled automatically on 402 responses
const client = new x402Client();
registerExactSvmScheme(client, { signer: svmSigner });
const fetchWithPayment = wrapFetchWithPayment(fetch, client);

// Call any Modulr x402 endpoint — the client pays and retries automatically
const response = await fetchWithPayment("https://modulr402.com/api/x402/wallet-risk", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ address: "9apA5U8..." }),
});

const report = await response.json();
console.log(report.riskLevel, report.riskScore);

API Reference

The SDK wraps the Modulr REST API. You can also call the free endpoints directly.

POST/api/generate/wallet-riskAnalyze a Solana wallet address
{ "address": "9apA5U8..." }
POST/api/generate/token-launchGenerate a token launch readiness report
{ "projectName": "MyToken", "chain": "Solana", "launchStage": "Pre-launch", ... }
POST/api/audit/smart-contractRun a smart contract audit
{ "contractText": "...", "language": "Solidity", "reviewDepth": "Standard Review" }
POST/api/generate/token-siteGenerate a production-ready token launch website
{ "tokenName": "MyToken", "ticker": "MTK", "contractAddress": "...", "description": "...", "vibe": "professional" }
POST/api/generate/agentGenerate a complete TypeScript agent script
{ "agentName": "Whale Tracker", "agentType": "Wallet Monitor", "targetChain": "Solana", "framework": "Vanilla TypeScript", "description": "..." }

Error handling

import { Modulr, ModulrError } from '@modulr/sdk'

const modulr = new Modulr()

try {
  const report = await modulr.walletRisk.analyze('address')
} catch (err) {
  if (err instanceof ModulrError) {
    console.error(err.message)
    console.error(err.status) // 400 | 408 | 503
  }
}

Configuration

All options are optional. The SDK works out of the box with no configuration.

Option
Default
Description
baseUrl
https://modulr402.com
API base URL
timeoutMs
30000
Request timeout in milliseconds
maxRetries
3
Retry attempts on 503 / 529