{"_id":"@axnetfun/axnet-sdk-ts","_rev":"6-5e8f4692c237360eba35ba89748046a5","name":"@axnetfun/axnet-sdk-ts","dist-tags":{"latest":"1.0.5"},"versions":{"1.0.0":{"name":"@axnetfun/axnet-sdk-ts","version":"1.0.0","author":{"name":"Axnet"},"license":"MIT","_id":"@axnetfun/axnet-sdk-ts@1.0.0","maintainers":[{"name":"axnetfun","email":"info@axnet.fun"}],"dist":{"shasum":"b7341a39addde270e89755430522590a325e445d","tarball":"https://registry.npmjs.org/@axnetfun/axnet-sdk-ts/-/axnet-sdk-ts-1.0.0.tgz","fileCount":6,"integrity":"sha512-wFXaaGwELEVnz5uXF3YsbqQPEqOgZkCDjDxdjNBXT4H8kZm98rfz4pWDOJdEXPXdVnJXT5J3EjJoYGv+tajvZw==","signatures":[{"sig":"MEQCIFUplv54B2Oe74B2MFdfQPdEPW4jXe/11i3mYp99oeORAiBMldsf063Kldw9m//zrBWbpDriFfYtPiVFyQb1/SALXA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13240},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"773c00d97c067731836b2f7e704802f579017992","scripts":{"dev":"tsup src/index.ts --format cjs,esm --watch --dts","lint":"tsc --noEmit","test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"axnetfun","email":"info@axnet.fun"},"_npmVersion":"11.6.0","description":"Stateless x402 Swap SDK for Solana Agents","directories":{},"_nodeVersion":"24.1.0","dependencies":{"@solana/web3.js":"^1.98.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^4.1.2","ts-node":"^10.9.0","typescript":"^5.9.3"},"peerDependencies":{"@solana/web3.js":"^1.98.4"},"_npmOperationalInternal":{"tmp":"tmp/axnet-sdk-ts_1.0.0_1774802256142_0.7262009230220918","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@axnetfun/axnet-sdk-ts","version":"1.0.1","author":{"name":"Axnet"},"license":"MIT","_id":"@axnetfun/axnet-sdk-ts@1.0.1","maintainers":[{"name":"axnetfun","email":"info@axnet.fun"}],"dist":{"shasum":"8946ab679f0e4a0694355da689d48d3af26ca0fe","tarball":"https://registry.npmjs.org/@axnetfun/axnet-sdk-ts/-/axnet-sdk-ts-1.0.1.tgz","fileCount":6,"integrity":"sha512-P6FG4JoWR1q+cuwhKyHqgCspsSc8tqmsw+pzatgpK2Q7lmK+UKJ/iFcUWVJBDhRn4VKBtxBCIbFOMvIUh5cIRQ==","signatures":[{"sig":"MEUCIQDYU3Kw9BhN6nXKvMkAAELVQne7dz+RfFaLj66Xlep7iQIgKpntS4akUwNQpEZ6KjyUvdQ+VWIxWLPh9oJu3Z3e13o=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13168},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"9a7b46313871a633f1716042c8b3be31cf3e98eb","scripts":{"dev":"tsup src/index.ts --format cjs,esm --watch --dts","lint":"tsc --noEmit","test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"axnetfun","email":"info@axnet.fun"},"_npmVersion":"11.6.0","description":"Stateless x402 Swap SDK for Solana Agents","directories":{},"_nodeVersion":"24.1.0","dependencies":{"@solana/web3.js":"^1.98.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^4.1.2","ts-node":"^10.9.0","typescript":"^5.9.3"},"peerDependencies":{"@solana/web3.js":"^1.98.4"},"_npmOperationalInternal":{"tmp":"tmp/axnet-sdk-ts_1.0.1_1774802412055_0.4307404344634902","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@axnetfun/axnet-sdk-ts","version":"1.0.2","author":{"name":"Axnet"},"license":"MIT","_id":"@axnetfun/axnet-sdk-ts@1.0.2","maintainers":[{"name":"axnetfun","email":"info@axnet.fun"}],"dist":{"shasum":"1b6ec60b0a8f5af73b9f9323a5857a97e69ed97a","tarball":"https://registry.npmjs.org/@axnetfun/axnet-sdk-ts/-/axnet-sdk-ts-1.0.2.tgz","fileCount":6,"integrity":"sha512-ohRJLf6imJ0kscpeAqWN4Czq23oCWYE3O0WrbSWvhuSqzZM1ZZl5Z6oBltRe5UxEqXtFlMI/a6RR0JeM0x5feA==","signatures":[{"sig":"MEUCIFloZEL4F17xEMkSrg6m2Zdhjj8D09lTYhCEZe3jySaYAiEAsp5QD2+PjsxzZq0aUGPjhXCS3SltW8qsU5uy+kAzOuI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13249},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"a6c69bec007ad2e051953d343d59efbedfc85445","scripts":{"dev":"tsup src/index.ts --format cjs,esm --watch --dts","lint":"tsc --noEmit","test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"axnetfun","email":"info@axnet.fun"},"_npmVersion":"11.6.0","description":"Stateless x402 Swap SDK for Solana Agents","directories":{},"_nodeVersion":"24.1.0","dependencies":{"@solana/web3.js":"^1.98.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^4.1.2","ts-node":"^10.9.0","typescript":"^5.9.3"},"peerDependencies":{"@solana/web3.js":"^1.98.4"},"_npmOperationalInternal":{"tmp":"tmp/axnet-sdk-ts_1.0.2_1774802781209_0.7820706780103874","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@axnetfun/axnet-sdk-ts","version":"1.0.3","author":{"name":"Axnet"},"license":"MIT","_id":"@axnetfun/axnet-sdk-ts@1.0.3","maintainers":[{"name":"axnetfun","email":"info@axnet.fun"}],"dist":{"shasum":"752991e4a4759d518880480e40982da836c45678","tarball":"https://registry.npmjs.org/@axnetfun/axnet-sdk-ts/-/axnet-sdk-ts-1.0.3.tgz","fileCount":6,"integrity":"sha512-RCWruISpqKbIItRYqCJWjF5DePcJFRsFD1rnHEXBQjLHXdvQBOgANtn6VYBidz4u2zS6TZ8VxG6/6bOqnhib3g==","signatures":[{"sig":"MEUCICjh6CiIXC/OzjhTSqyC9hVoS4Md125SCa8SNh4EghHHAiEAr1n1M2ok/3mso6RqyeqIuo34jJJh6o5yDhxOV/MGcHU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13267},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"c8e2d185b21305539c6f9a1024caee8df87846d4","scripts":{"dev":"tsup src/index.ts --format cjs,esm --watch --dts","lint":"tsc --noEmit","test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"axnetfun","email":"info@axnet.fun"},"_npmVersion":"11.6.0","description":"Stateless x402 Swap SDK for Solana Agents","directories":{},"_nodeVersion":"24.1.0","dependencies":{"@solana/web3.js":"^1.98.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^4.1.2","ts-node":"^10.9.0","typescript":"^5.9.3"},"peerDependencies":{"@solana/web3.js":"^1.98.4"},"_npmOperationalInternal":{"tmp":"tmp/axnet-sdk-ts_1.0.3_1775060748730_0.2380155898704268","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@axnetfun/axnet-sdk-ts","version":"1.0.4","author":{"name":"Axnet"},"license":"MIT","_id":"@axnetfun/axnet-sdk-ts@1.0.4","maintainers":[{"name":"axnetfun","email":"info@axnet.fun"}],"dist":{"shasum":"e174be3558a8137ffa61a8760fcecdaddc721a94","tarball":"https://registry.npmjs.org/@axnetfun/axnet-sdk-ts/-/axnet-sdk-ts-1.0.4.tgz","fileCount":6,"integrity":"sha512-SZ87z/S2XaoAtAp7HR+ZgzKsV3cSCAYOcmUoK1+HZRgN8ZhUjv3ocDCcnwcOgnlqpwF8JPYjkNT9PWg+cJMHtw==","signatures":[{"sig":"MEYCIQDd01y1Wuq0SPLTR9O6K5+Nhm3wKmjj3B1qplLGnqbH6gIhAOgL8yQIRCfu5X8aYCLbh47J7O1f4OTSI7OGnyUWfXLk","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13269},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"}},"gitHead":"014a07681d3fd351327140ef88f06f37899ce9e4","scripts":{"dev":"tsup src/index.ts --format cjs,esm --watch --dts","lint":"tsc --noEmit","test":"vitest run","build":"tsup src/index.ts --format cjs,esm --dts --clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"axnetfun","email":"info@axnet.fun"},"_npmVersion":"11.6.0","description":"Stateless x402 Swap SDK for Solana Agents","directories":{},"_nodeVersion":"24.1.0","dependencies":{"@solana/web3.js":"^1.98.4"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","vitest":"^4.1.2","ts-node":"^10.9.0","typescript":"^5.9.3"},"peerDependencies":{"@solana/web3.js":"^1.98.4"},"_npmOperationalInternal":{"tmp":"tmp/axnet-sdk-ts_1.0.4_1775317341137_0.5272461587441328","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@axnetfun/axnet-sdk-ts","version":"1.0.5","description":"Stateless x402 Swap SDK for Solana Agents","author":{"name":"Axnet"},"license":"MIT","type":"module","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js","types":"./dist/index.d.ts"}},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean","dev":"tsup src/index.ts --format cjs,esm --watch --dts","test":"vitest run","lint":"tsc --noEmit","prepublishOnly":"npm run build"},"dependencies":{"@solana/web3.js":"^1.98.4"},"devDependencies":{"ts-node":"^10.9.0","tsup":"^8.0.0","typescript":"^5.9.3","vitest":"^4.1.2"},"peerDependencies":{"@solana/web3.js":"^1.98.4"},"_id":"@axnetfun/axnet-sdk-ts@1.0.5","gitHead":"014a07681d3fd351327140ef88f06f37899ce9e4","_nodeVersion":"24.1.0","_npmVersion":"11.6.0","dist":{"integrity":"sha512-mGQorrVVv2Vg6uDXxjdZe1BB8kzOvN29dUKgOegZthPggPqxGAWRnB1z+mWYg9vwMc6rLXGr1coNhSqJqeA6fw==","shasum":"95dc5e537eb4a618669ed51bb3f2ad009404ca9f","tarball":"https://registry.npmjs.org/@axnetfun/axnet-sdk-ts/-/axnet-sdk-ts-1.0.5.tgz","fileCount":6,"unpackedSize":13269,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBK7wrzMsyUSxiWiUoBL/cDUukPMKaXVGDsIdg9HHL9hAiEAlr7gZjpsSvHtjfStNIXDqhEfjBnyEhVjacp/p6aLAXY="}]},"_npmUser":{"name":"axnetfun","email":"info@axnet.fun"},"directories":{},"maintainers":[{"name":"axnetfun","email":"info@axnet.fun"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/axnet-sdk-ts_1.0.5_1775317500063_0.4081256514683478"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-29T16:37:36.081Z","modified":"2026-04-04T15:45:00.344Z","1.0.0":"2026-03-29T16:37:36.297Z","1.0.1":"2026-03-29T16:40:12.204Z","1.0.2":"2026-03-29T16:46:21.365Z","1.0.3":"2026-04-01T16:25:48.858Z","1.0.4":"2026-04-04T15:42:21.289Z","1.0.5":"2026-04-04T15:45:00.229Z"},"author":{"name":"Axnet"},"license":"MIT","description":"Stateless x402 Swap SDK for Solana Agents","maintainers":[{"name":"axnetfun","email":"info@axnet.fun"}],"readme":"# @axnetfun/axnet-sdk-ts 🛰️\n\nThe official TypeScript SDK for **Axnet**, the first stateless, x402-powered swap gateway for Solana Agents. \n\nAxnet abstracts the complexity of the x402 \"Payment Required\" handshake, allowing agents to execute dual-transaction swaps (Fee + Jupiter) without needing a local RPC connection or complex transaction management.\n\n## 🧱 Key Features\n\n- **Stateless & RPC-less**: Execute swaps without a `Connection` object. No Helius/Quicknode API keys required.\n- **x402 Optimized**: Built-in handling for the x402 dual-transaction handshake.\n- **Managed Local Signing**: Keep your private keys in your own environment while Axnet handles the relay.\n- **One-Ping Execution**: Get both signatures and relay them back to a unified endpoint in a single logical flow.\n\n## 🚀 Quickstart\n\n### Installation\n\n```bash\nnpm install @axnetfun/axnet-sdk-ts\n```\n\n## 🚀 Basic Usage\n\nThe following example demonstrates how to execute a swap using a local `Keypair`. Note that no RPC `Connection` is required, as Axnet handles the broadcast.\n\n```typescript\nimport { AxnetSDK } from '@axnetfun/axnet-sdk-ts';\nimport { Keypair } from '@solana/web3.js';\n\n// 1. Initialize the Stateless SDK\nconst sdk = new AxnetSDK();\n\n// 2. Load your Agent Keypair (Private Key stays local)\nconst agentWallet = Keypair.fromSecretKey(Uint8Array.from([/* your secret key */]));\n\nasync function executeAgentSwap() {\n    try {\n        const result = await sdk.swap(\n            {\n                userPublicKey: agentWallet.publicKey.toBase58(),\n                inputMint: \"So11111111111111111111111111111111111111112\", // SOL\n                inputDecimals: 9,\n                outputMint: \"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v\", // USDC\n                amount: \"0.1\", // Swap 0.1 SOL\n                slippageBps: 50\n            },\n            // --- Signer Logic: Purely Local ---\n            async (txs) => {\n                console.log(\"✍️ Signing dual-transaction payload locally...\");\n                txs.forEach(tx => tx.sign([agentWallet]));\n                return txs;\n            },\n            // --- Handshake Hook: Inspect the x402 Metadata ---\n            async (data) => {\n                console.log(`📡 Handshake Received!`);\n                console.log(`🆔 Agent ID: ${data.headers.agentId}`);\n                console.log(`🔗 x402 Session: ${data.headers.x402id}`);\n                console.log(`🛰️ Payload: ${JSON.stringify(data.payload, null, 2)}`);\n            }\n        );\n\n        console.log(\"🎉 Swap Success! Signature:\", result.signature);\n    } catch (error) {\n        console.error(\"❌ Axnet Execution Failed:\", error);\n    }\n}\n\nexecuteAgentSwap();\n```\n\n## 🏗️ SDK Architecture\n\nThe Axnet SDK implements a **Stateless Dual-Hop** architecture. It abstracts the complexity of the x402 \"Payment Required\" handshake into a single logical execution block.\n\n```typescript\n/**\n * CONCEPTUAL FLOW:\n * 1. [SDK] -- POST /swap (Intent) --> [Axnet API]\n * 2. [SDK] <-- 402 + Unsigned Txs -- [Axnet API]\n * 3. [SDK] -- Local Sign (onHandshake) -- [Agent Wallet]\n * 4. [SDK] -- POST /swap (Signed + x-402-id) --> [Axnet API]\n * 5. [SDK] <-- 200 + Signature ----- [Axnet API]\n */\n```\n\n## 🛠️ How it Works\n\nThe Axnet SDK implements a **Stateless Dual-Hop** architecture. It abstracts the complexity of the x402 \"Payment Required\" handshake into a single logical execution block.\n\n1.  **Handshake Interceptor**: The SDK automatically catches the `402 Payment Required` response from the first call. It extracts the `x-402-id` and `x-402-agent-id` from the headers to maintain session state without a database.\n2.  **Stateless Signing**: The SDK is entirely agnostic to the blockchain. It receives raw transaction bytes from the server, allows your local wallet to sign them, and relays the signatures back.\n3.  **Unified Routing**: Both the \"Quote\" and \"Execution\" phases hit the same `/swap` endpoint. The server differentiates the requests based on the presence of the `x-402-id` header.\n\n## 📄 API Reference\n\n### `AxnetSDK`\n\n| Method | Parameters | Returns |\n| :--- | :--- | :--- |\n| `swap` | `(params, signer, onHandshake?)` | `Promise<AxnetResponse>` |\n\n#### `AxnetSwapParams`\n- `userPublicKey`: The base58 address of the swapping wallet.\n- `inputMint`: Source token mint address.\n- `inputDecimals`: Decimal precision of the input token (9 for SOL, 6 for USDC).\n- `outputMint`: Destination token mint address.\n- `amount`: String or Number (human-readable format).\n- `slippageBps`: (Optional) Slippage in basis points (e.g., 50 = 0.5%).\n\n## 🛡️ Security\n\n- **Private Keys**: Never transmitted to the Axnet API. Signing is performed strictly within your agent's local runtime.\n- **RPC Privacy**: Axnet acts as a shielded gateway. Your agent's IP and trading patterns are never directly exposed to public RPC providers.\n- **Dual-Tx Atomicity**: The architecture ensures the fee and swap are linked, protecting the agent from paying fees on non-executable swaps.\n\n---\n**Registry ID**: `DEpPuMuVZGUAJtN5gVxUNFQUL8jsjF26T781gMT1twE`  \n","readmeFilename":"README.md"}