{"_id":"@auron-solana/sdk","name":"@auron-solana/sdk","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@auron-solana/sdk","version":"0.1.0","description":"TypeScript SDK for the Auron USDC→INR settlement infrastructure on Solana","author":{"name":"Auron","email":"anirudhvashisth2006@gmail.com"},"license":"MIT","homepage":"https://github.com/anirudhh206/auron","repository":{"type":"git","url":"git+https://github.com/anirudhh206/auron.git","directory":"packages/sdk"},"keywords":["auron","solana","usdc","upi","india","settlement","payments","stablecoin","defi"],"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean","dev":"tsup src/index.ts --format cjs,esm --dts --watch","type-check":"tsc --noEmit","prepublishOnly":"npm run build && npm run type-check"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"engines":{"node":">=18.0.0"},"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0"},"gitHead":"f550e08d91303b1899e366129f8db38e77eaac36","_id":"@auron-solana/sdk@0.1.0","bugs":{"url":"https://github.com/anirudhh206/auron/issues"},"_nodeVersion":"24.14.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-Cn+vSypLlBzzvXx4s14yY2Ux2EtZbvEJ5WB9g6lXZjYBbDMYY4d0eiDITMw9ch3IeNOqnOs1ttpsy7WaIPcsgw==","shasum":"dabbbd9ed386ff7293ccb810f0c3306aa3164718","tarball":"https://registry.npmjs.org/@auron-solana/sdk/-/sdk-0.1.0.tgz","fileCount":6,"unpackedSize":43068,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDu0Mr0wPE/+9rtFMtVr2FR+Bi8wjtoCUBKUfepqvcnSgIhAMufO53YeBnvc3fk/ChfMFGgJfTH2WMJckV7gxsQei7q"}]},"_npmUser":{"name":"anirudh22006","email":"anirudhvashisth2006@gmail.com"},"directories":{},"maintainers":[{"name":"anirudh22006","email":"anirudhvashisth2006@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.1.0_1781680381663_0.4945468232491472"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-17T07:13:01.488Z","0.1.0":"2026-06-17T07:13:01.797Z","modified":"2026-06-17T07:13:02.088Z"},"maintainers":[{"name":"anirudh22006","email":"anirudhvashisth2006@gmail.com"}],"description":"TypeScript SDK for the Auron USDC→INR settlement infrastructure on Solana","homepage":"https://github.com/anirudhh206/auron","keywords":["auron","solana","usdc","upi","india","settlement","payments","stablecoin","defi"],"repository":{"type":"git","url":"git+https://github.com/anirudhh206/auron.git","directory":"packages/sdk"},"author":{"name":"Auron","email":"anirudhvashisth2006@gmail.com"},"bugs":{"url":"https://github.com/anirudhh206/auron/issues"},"license":"MIT","readme":"# @auron/sdk\n\nTypeScript SDK for the [Auron](https://auron-mocha.vercel.app) settlement infrastructure — send USDC from a Solana wallet and deliver INR to any UPI account in seconds.\n\n```bash\nnpm install @auron/sdk\n```\n\n---\n\n## How it works\n\n1. Your app calls `getQuote(inrAmount)` to get the live USDC amount\n2. The user signs a Solana USDC transfer to the Auron treasury\n3. You call `pay()` with the confirmed transaction signature\n4. Auron verifies the on-chain transfer and routes INR to the merchant's UPI account\n5. `waitForCompletion()` polls until you have the bank UTR\n\n---\n\n## Quick start\n\n```ts\nimport { AuronClient } from '@auron/sdk';\n\nconst client = new AuronClient({\n  apiKey:  'your-api-key',\n  baseUrl: 'https://auron-mocha.vercel.app', // default\n});\n\n// 1. Get a live quote\nconst quote = await client.getQuote(500);\n// → { usdcAmount: 5.29, auronRate: 94.54, expiresAt: ... }\n\n// 2. Sign the Solana USDC transfer in your wallet (outside SDK scope)\nconst sig = await wallet.sendUsdc(AURON_TREASURY_ADDRESS, quote.usdcAmount);\n\n// 3. Submit the payment\nconst payment = await client.pay({\n  merchantUpiId: 'merchant@paytm',\n  merchantName:  'Swiggy',\n  inrAmount:     500,\n  usdcAmount:    quote.usdcAmount,\n  txSignature:   sig,\n  userId:        wallet.publicKey,\n});\n\n// 4. Wait for settlement and get the UTR\nconst final = await client.waitForCompletion(payment.paymentId, {\n  onPoll: (s) => console.log('status:', s.status),\n});\n\nconsole.log('UTR:', final.settlement?.utr);       // YESB...\nconsole.log('Solscan:', `https://solscan.io/tx/${payment.txSignature}`);\n```\n\n---\n\n## API reference\n\n### `new AuronClient(config)`\n\n```ts\nconst client = new AuronClient({\n  apiKey:    string,   // required — from your Auron dashboard\n  baseUrl?:  string,   // default: https://auron-mocha.vercel.app\n  timeoutMs?: number,  // default: 30000\n});\n```\n\n---\n\n### `client.getQuote(inrAmount)`\n\nGet a live USDC quote for an INR amount. The quote expires in 60 seconds.\n\n```ts\nconst quote = await client.getQuote(500);\n```\n\n```ts\ninterface QuoteResponse {\n  usdcAmount:    number;  // USDC to send (includes 0.85% spread)\n  marketRate:    number;  // raw CoinGecko INR/USDC rate\n  auronRate:     number;  // rate after spread\n  spreadPercent: number;  // 0.85\n  quotedAt:      string;  // ISO timestamp\n  expiresAt:     number;  // Unix ms — quote valid for 60s\n}\n```\n\n---\n\n### `client.pay(input)`\n\nSubmit a confirmed USDC→INR payment. The Solana transaction must already be signed and confirmed before calling this.\n\n```ts\nconst payment = await client.pay({\n  merchantUpiId: 'merchant@paytm',  // required — must contain @\n  merchantName:  'Swiggy',          // required\n  inrAmount:     500,               // required — INR amount\n  usdcAmount:    5.29,              // required — from getQuote()\n  txSignature:   'sig...',          // required — confirmed Solana tx\n  userId:        'wallet-pubkey',   // required — sender's wallet address\n  idempotencyKey?: string,          // optional — auto-generated if omitted\n  quoteFxRate?:    number,          // optional — for slippage guard\n});\n```\n\n```ts\ninterface PaymentResponse {\n  paymentId:    string;\n  status:       PaymentStatus;\n  usdcAmount:   number;\n  inrAmount:    number;\n  fxRate?:      number;\n  txSignature:  string;\n  utr?:         string;   // bank UTR — available after settlement\n  createdAt:    string;\n}\n```\n\n---\n\n### `client.getPayment(paymentId)`\n\nFetch the current status of a payment.\n\n```ts\nconst status = await client.getPayment(payment.paymentId);\n\nconsole.log(status.status);           // 'settling' | 'completed' | ...\nconsole.log(status.settlement?.utr);  // bank UTR when completed\nconsole.log(status.history);          // full state transition log\n```\n\n---\n\n### `client.waitForCompletion(paymentId, options?)`\n\nPoll until the payment reaches `completed`, `failed`, or `refunded`.\n\n```ts\nconst final = await client.waitForCompletion(payment.paymentId, {\n  intervalMs: 2000,   // poll every 2s (default)\n  timeoutMs:  60000,  // give up after 60s (default)\n  onPoll: (s) => console.log(s.status),\n});\n```\n\nThrows `AuronError` with code `\"TIMEOUT\"` if the payment doesn't settle within `timeoutMs`.\n\n---\n\n### `client.parseIntent(message, options?)`\n\nParse a natural-language payment instruction using Claude AI. Returns a structured intent with security flags.\n\n```ts\nconst result = await client.parseIntent('send ₹500 to priya@upi', {\n  userId:         'wallet-pubkey',  // for rate limiting\n  spendCeiling:   10000,            // user's INR spend limit\n  thirtyDayAvg:   2000,             // for anomaly detection\n  isNewRecipient: true,\n});\n\nif (result.type === 'action') {\n  console.log(result.action?.action);     // 'upi_payment'\n  console.log(result.action?.recipient);  // 'priya@upi'\n  console.log(result.action?.amount);     // 500\n  console.log(result.securityFlags);      // [] or [{ type: 'NEW_RECIPIENT_LARGE', ... }]\n}\n\nif (result.type === 'clarification') {\n  console.log(result.question); // \"Which UPI account should I send to?\"\n}\n```\n\n---\n\n## Payment statuses\n\n| Status | Meaning |\n|---|---|\n| `initiated` | Payment record created |\n| `quoted` | FX rate locked |\n| `signed` | Solana tx received |\n| `verified` | On-chain USDC transfer confirmed |\n| `settling` | INR payout dispatched to provider |\n| `completed` | INR delivered, bank UTR issued |\n| `failed` | Settlement failed (see history) |\n| `refunded` | USDC returned to sender |\n\n---\n\n## Error handling\n\nAll errors are instances of `AuronError` with a typed `code` field.\n\n```ts\nimport { AuronClient, AuronError, isAuronError } from '@auron/sdk';\n\ntry {\n  await client.pay({ ... });\n} catch (err) {\n  if (isAuronError(err)) {\n    switch (err.code) {\n      case 'INVALID_UPI_ID':         // bad UPI ID format\n      case 'PAYMENT_LIMIT_EXCEEDED': // above ₹2L per-tx cap\n      case 'INSUFFICIENT_LIQUIDITY': // treasury reserve too low\n      case 'TX_VERIFICATION_FAILED': // Solana tx not confirmed\n      case 'RATE_LIMITED':           // slow down\n      case 'TIMEOUT':                // retry (err.retryable === true)\n    }\n    console.log(err.retryable); // true = safe to retry\n    console.log(err.status);    // HTTP status code\n  }\n}\n```\n\n---\n\n## TypeScript\n\nThe SDK ships full type definitions. No `@types/` package needed.\n\n```ts\nimport type {\n  AuronConfig,\n  PaymentInput,\n  PaymentResponse,\n  PaymentStatus,\n  PaymentStatusResponse,\n  QuoteResponse,\n  IntentResponse,\n  ParsedIntent,\n  SecurityFlag,\n  WaitOptions,\n} from '@auron/sdk';\n```\n\n---\n\n## Requirements\n\n- Node.js 18+ or any modern browser (uses `fetch` and `AbortController`)\n- An Auron API key\n\n---\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-63a0c872907e76154deb632235275a81"}