{"_id":"@amplifyworld/sdk","name":"@amplifyworld/sdk","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@amplifyworld/sdk","version":"0.1.0","description":"TypeScript SDK for the $AMPS token on Base — build AI-powered apps with token payments","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"},"./testing":{"types":"./dist/testing.d.ts","import":"./dist/testing.js","require":"./dist/testing.cjs"},"./middleware":{"types":"./dist/middleware/express.d.ts","import":"./dist/middleware/express.js","require":"./dist/middleware/express.cjs"}},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","test":"vitest run","prepack":"cp ../../README.md ./README.md"},"dependencies":{"viem":">=2.0.0"},"devDependencies":{"tsup":"^8.3.0","typescript":"^5.6.0","vitest":"^4.1.10"},"peerDependencies":{"viem":">=2.0.0"},"keywords":["amps","amplifyworld","base-chain","erc20","ai-payments","web3","viem"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/amplify-world/sdk.git"},"homepage":"https://amplifyworld.ai","publishConfig":{"access":"public"},"_id":"@amplifyworld/sdk@0.1.0","gitHead":"4ed97cdfca6335fe933d2c93b1a3baa0609344a6","bugs":{"url":"https://github.com/amplify-world/sdk/issues"},"_nodeVersion":"22.13.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-fuj5x2eW5+1sSkvjFNXOJF6txkVO5Dn2nfy34F6rY16MuyVffkQ8H1IT6Ido6H2P6Qw5sMbl4IADei2A00olhQ==","shasum":"6281efd76c1e1d848c86777a7b11da42931346cb","tarball":"https://registry.npmjs.org/@amplifyworld/sdk/-/sdk-0.1.0.tgz","fileCount":30,"unpackedSize":293740,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCvctDuglvaqZWNBH5w1RQKhZyi++7qb9AhEZiFiaU8wwIgXmYxtExaNkgZU3HlYG111idpVbEqVA9SsUZcwqoMpNA="}]},"_npmUser":{"name":"amplifyworld","email":"accounts@amplifyworld.ai"},"directories":{},"maintainers":[{"name":"amplifyworld","email":"accounts@amplifyworld.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.1.0_1784725981181_0.5071878496423512"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-22T13:13:01.050Z","0.1.0":"2026-07-22T13:13:01.343Z","modified":"2026-07-22T13:13:01.570Z"},"maintainers":[{"name":"amplifyworld","email":"accounts@amplifyworld.ai"}],"description":"TypeScript SDK for the $AMPS token on Base — build AI-powered apps with token payments","homepage":"https://amplifyworld.ai","keywords":["amps","amplifyworld","base-chain","erc20","ai-payments","web3","viem"],"repository":{"type":"git","url":"git+https://github.com/amplify-world/sdk.git"},"bugs":{"url":"https://github.com/amplify-world/sdk/issues"},"license":"MIT","readme":"# ⚡ AMPS Developer Toolkit\n\nThe official TypeScript SDK for building apps powered by **$AMPS** tokens on [Base](https://base.org) chain.\n\nBuilt for developers and AI agent builders who want to charge for services in AMPS tokens.\n\n## Quick Start\n\n```bash\nnpm install @amplifyworld/sdk viem\n```\n\n```typescript\nimport { createAmpsClient } from '@amplifyworld/sdk'\n\n// Read-only (check balances, watch events)\nconst amps = createAmpsClient()\nconst balance = await amps.getBalance('0x...')\nconsole.log(`${balance.formatted} AMPS`) // \"1,500.25 AMPS\"\n\n// With wallet (transfer, approve)\nconst amps = createAmpsClient({ privateKey: '0x...' })\nawait amps.transfer('0xRecipient', '100')\n```\n\n### RPC endpoint\n\nBy default, `createAmpsClient` and `createAmpsGateway` use Base's free public\nRPC (`https://mainnet.base.org`). It's fine for light testing, but it's shared\nand rate-limited — repeated reads/writes in a short window can throw\n`\"over rate limit\"`. For anything with real or sustained traffic, pass your\nown `rpcUrl`:\n\n```typescript\nconst amps = createAmpsClient({ rpcUrl: 'https://base-mainnet.g.alchemy.com/v2/YOUR_KEY' })\n```\n\n(Alchemy, Infura, and QuickNode all have free tiers with much higher per-key\nlimits than the shared public endpoint.)\n\n## AI Payment Gateway\n\nCharge users in $AMPS per API call — the killer feature for AI agent developers:\n\n```typescript\nimport { createAmpsGateway } from '@amplifyworld/sdk'\n\nconst gateway = createAmpsGateway({\n  privateKey: process.env.SERVICE_WALLET_KEY,\n  pricing: {\n    'chat.completion': '0.5',  // 0.5 AMPS per chat\n    'image.generate': '2.0',   // 2 AMPS per image\n  },\n})\n\nconst receipt = await gateway.charge({\n  payer: '0xUserAddress',\n  service: 'chat.completion',\n})\n// receipt.txHash, receipt.amount, receipt.timestamp\n```\n\n## Express Middleware\n\nGate API routes behind AMPS payments with one line:\n\n```typescript\nimport { ampsPaywall } from '@amplifyworld/sdk/middleware'\n\napp.post('/api/generate', ampsPaywall({\n  price: '1.0',\n  recipient: '0xYourWallet',\n}), handler)\n// Returns 402 Payment Required with AMPS payment instructions\n```\n\n## Features\n\n| Feature | Description |\n|---|---|\n| **Core SDK** | `getBalance`, `transfer`, `approve`, `transferFrom`, `watchTransfers` |\n| **AI Gateway** | Charge-per-call with pricing tables, dynamic pricing, sessions |\n| **Middleware** | Express payment paywall with x402-style 402 responses |\n| **Receipts** | On-chain payment verification and proof |\n| **Type-Safe** | Full TypeScript with exported types for everything |\n| **Minimal** | Zero runtime dependencies beyond `viem` |\n\n## Token Details\n\n| | |\n|---|---|\n| **Name** | AmplifyWorld |\n| **Symbol** | AMPS |\n| **Chain** | Base (8453) |\n| **Type** | ERC-20 |\n| **Decimals** | 18 |\n| **Contract** | [`0x1A074F116786248FC79B130E6379293C7EF604a4`](https://basescan.org/token/0x1A074F116786248FC79B130E6379293C7EF604a4) |\n| **Website** | [amplifyworld.ai](https://amplifyworld.ai) |\n\n## Examples\n\n```bash\n# Basic transfer\ncd examples/basic-transfer && npx tsx index.ts\n\n# AI chatbot with AMPS payments\ncd examples/ai-chatbot && npx tsx index.ts\n\n# Express API with payment paywall\ncd examples/express-api && npx tsx index.ts\n\n# Coin flip game — full pay-to-play flow with a real connected wallet\ncd examples/coin-flip-game && npx tsx server.ts\n```\n\nThe coin flip game is the most complete demo — it runs in a no-setup simulation\nmode by default, or against real $AMPS on Base mainnet with a MetaMask-style\nwallet connection. See [`examples/coin-flip-game/README.md`](https://github.com/amplify-world/sdk/blob/master/examples/coin-flip-game/README.md)\nfor live-mode setup.\n\n## Links\n\n- [AmplifyWorld](https://amplifyworld.ai)\n- [BaseScan](https://basescan.org/token/0x1A074F116786248FC79B130E6379293C7EF604a4)\n- [Twitter](https://x.com/amplifyworld)\n- [Discord](https://discord.gg/pBrHh7Nssc)\n\n## License\n\nMIT\n","readmeFilename":"README.md","_rev":"1-5c0ab444415043fe7c831ad8d7b4fcfd"}