{"_id":"@3mate/gas-station-sdk","_rev":"5-748c6d681a1c8668a35789ac3f88579b","name":"@3mate/gas-station-sdk","dist-tags":{"latest":"0.3.2"},"versions":{"0.1.0":{"name":"@3mate/gas-station-sdk","version":"0.1.0","keywords":["sui","iota","blockchain","gas-station","sponsorship","web3","3mate"],"author":{"name":"3mate Labs"},"license":"MIT","_id":"@3mate/gas-station-sdk@0.1.0","maintainers":[{"name":"easonc13","email":"eason.tw.chen@gmail.com"},{"name":"ruru_arcade","email":"ruru@3matelabs.com"}],"homepage":"https://github.com/3MateLabs/gas-station-sdk#readme","bugs":{"url":"https://github.com/3MateLabs/gas-station-sdk/issues"},"dist":{"shasum":"3bf01a0d3f38f4760574c9f1830c349d1c6d6fdc","tarball":"https://registry.npmjs.org/@3mate/gas-station-sdk/-/gas-station-sdk-0.1.0.tgz","fileCount":7,"integrity":"sha512-Hba2CUloMPM17Pne2shhabBOSP02GCMZGm8AN4/7gNCR5CiLRL6g8U22RZfIuPj8+Ka99j/okl+WJpQoQhsUnA==","signatures":[{"sig":"MEQCICK94jZ4d8CNvgiRq7nFI4iUu1CUU9lRuz2CSAaycbYXAiBvRT57+KheFYa63hjsZwGHQB7CXz1v3pP5sXKLvYwMOQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17098},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","test":"vitest","build":"tsup src/index.ts --format cjs,esm --dts --clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"ruru_arcade","email":"ruru@3matelabs.com"},"repository":{"url":"git+https://github.com/3MateLabs/gas-station-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"Official SDK for 3mate Gas Station - Seamless blockchain transaction sponsorship for SUI and IOTA","directories":{},"_nodeVersion":"23.11.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","vitest":"^1.1.0","typescript":"^5.3.3","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gas-station-sdk_0.1.0_1754054998502_0.4042421579672515","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@3mate/gas-station-sdk","version":"0.2.0","keywords":["sui","iota","blockchain","gas-station","sponsorship","web3","3mate"],"author":{"name":"3mate Labs"},"license":"MIT","_id":"@3mate/gas-station-sdk@0.2.0","maintainers":[{"name":"easonc13","email":"eason.tw.chen@gmail.com"},{"name":"ruru_arcade","email":"ruru@3matelabs.com"}],"homepage":"https://github.com/3MateLabs/gas-station-sdk#readme","bugs":{"url":"https://github.com/3MateLabs/gas-station-sdk/issues"},"dist":{"shasum":"6d611827c2bd48d813aced9c178b67d82e9e9e3e","tarball":"https://registry.npmjs.org/@3mate/gas-station-sdk/-/gas-station-sdk-0.2.0.tgz","fileCount":7,"integrity":"sha512-/dd5JxtNlPyBxLSs2eHkoZqhKtDXUmzCFxLoNGOQazY1S8Y++zKks/9AkEVkj85WJ1E7u7mJ760HU/NfwVoxQQ==","signatures":[{"sig":"MEUCIFO8M7iEN/sHRKyYqTw9Tpw3NoQitCOMFF5oUqA367IVAiEA4rfBB6r1Djtcr16Z+Ny/ghpVkeRX9t/XMHoNY1jRQTw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18755},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","test":"vitest","build":"tsup src/index.ts --format cjs,esm --dts --clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"ruru_arcade","email":"ruru@3matelabs.com"},"repository":{"url":"git+https://github.com/3MateLabs/gas-station-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"Official SDK for 3mate Gas Station - Seamless blockchain transaction sponsorship for SUI and IOTA","directories":{},"_nodeVersion":"23.11.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","vitest":"^1.1.0","typescript":"^5.3.3","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gas-station-sdk_0.2.0_1754059063576_0.7705629550231774","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@3mate/gas-station-sdk","version":"0.3.0","keywords":["sui","iota","blockchain","gas-station","sponsorship","web3","3mate"],"author":{"name":"3mate Labs"},"license":"MIT","_id":"@3mate/gas-station-sdk@0.3.0","maintainers":[{"name":"easonc13","email":"eason.tw.chen@gmail.com"},{"name":"ruru_arcade","email":"ruru@3matelabs.com"}],"homepage":"https://github.com/3MateLabs/gas-station-sdk#readme","bugs":{"url":"https://github.com/3MateLabs/gas-station-sdk/issues"},"dist":{"shasum":"fa893470f13a223d5fcd39c084afa171f865b695","tarball":"https://registry.npmjs.org/@3mate/gas-station-sdk/-/gas-station-sdk-0.3.0.tgz","fileCount":7,"integrity":"sha512-dw5hnTAqCWKAt6NaGpbtyOLWafcrlOJSRXgzV9ST+qCiSfF1u5XUixhuNaKyszfHO/pyr/8zidUE6CgboPYrhg==","signatures":[{"sig":"MEUCICmTMsFSScO2g04QhJib+Zwc+Vj29EbFtkRGzGuBP8hcAiEAwjM3P+0FD3F7xMfmFBY3o8pF5yWJTgc7Z675X3JVLSI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":19947},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","test":"vitest","build":"tsup src/index.ts --format cjs,esm --dts --clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"ruru_arcade","email":"ruru@3matelabs.com"},"repository":{"url":"git+https://github.com/3MateLabs/gas-station-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"Official SDK for 3mate Gas Station - Seamless blockchain transaction sponsorship for SUI and IOTA","directories":{},"_nodeVersion":"23.11.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","vitest":"^1.1.0","typescript":"^5.3.3","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gas-station-sdk_0.3.0_1754063194129_0.20866255232727537","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@3mate/gas-station-sdk","version":"0.3.1","keywords":["sui","iota","blockchain","gas-station","sponsorship","web3","3mate"],"author":{"name":"3mate Labs"},"license":"MIT","_id":"@3mate/gas-station-sdk@0.3.1","maintainers":[{"name":"easonc13","email":"eason.tw.chen@gmail.com"},{"name":"ruru_arcade","email":"ruru@3matelabs.com"}],"homepage":"https://github.com/3MateLabs/gas-station-sdk#readme","bugs":{"url":"https://github.com/3MateLabs/gas-station-sdk/issues"},"dist":{"shasum":"67eb291020daab30ab47f9cc286c6ab53d343f0c","tarball":"https://registry.npmjs.org/@3mate/gas-station-sdk/-/gas-station-sdk-0.3.1.tgz","fileCount":7,"integrity":"sha512-/eqStikKbVUI+pVm8bMdvFcOZ+9plkmxYDaSbzSt6PpJn4+HvZjKWQFtL56MoK5XDYTIKXkIDSddZpWX17kOCQ==","signatures":[{"sig":"MEYCIQCBHSCPzMQjDksF/F/1tU3ySKCTKZIXxbbECLw7yUvrOAIhALQB12IVLlNhZDJJFqk7cUJECLtI5cwhANUlTPW8/Zuj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":20527},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","scripts":{"dev":"tsup src/index.ts --format cjs,esm --dts --watch","test":"vitest","build":"tsup src/index.ts --format cjs,esm --dts --clean","prepublishOnly":"npm run build"},"_npmUser":{"name":"ruru_arcade","email":"ruru@3matelabs.com"},"repository":{"url":"git+https://github.com/3MateLabs/gas-station-sdk.git","type":"git"},"_npmVersion":"10.9.2","description":"Official SDK for 3mate Gas Station - Seamless blockchain transaction sponsorship for SUI and IOTA","directories":{},"_nodeVersion":"23.11.0","_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.1","vitest":"^1.1.0","typescript":"^5.3.3","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/gas-station-sdk_0.3.1_1754064049049_0.2929552584029118","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"@3mate/gas-station-sdk","version":"0.3.2","description":"Official SDK for 3mate Gas Station - Seamless blockchain transaction sponsorship for SUI and IOTA","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 --dts --watch","test":"vitest","prepublishOnly":"npm run build"},"keywords":["sui","iota","blockchain","gas-station","sponsorship","web3","3mate"],"author":{"name":"3mate Labs"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/3MateLabs/gas-station-sdk.git"},"devDependencies":{"@types/node":"^20.0.0","tsup":"^8.0.1","typescript":"^5.3.3","vitest":"^1.1.0"},"_id":"@3mate/gas-station-sdk@0.3.2","bugs":{"url":"https://github.com/3MateLabs/gas-station-sdk/issues"},"homepage":"https://github.com/3MateLabs/gas-station-sdk#readme","_nodeVersion":"23.11.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-aME5SgBvrrHobEslxwYiEHEUX7897Ay53U3FmpCnrm9NKxsgTSHqTDDNTG0qT2vjA/18dvJ2GRxygmLvEyta7w==","shasum":"f612868c4aa471cf2ae35ea96463ae67bd3ee47a","tarball":"https://registry.npmjs.org/@3mate/gas-station-sdk/-/gas-station-sdk-0.3.2.tgz","fileCount":7,"unpackedSize":25041,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCZL7nwoeeFy+N4gIFYpLCei0ug3KHycE+xOdkoIOtzKAIhANVTJR51bwbr7tXwTD7u/dVZqhDCDi23DDqY7MjvHxOt"}]},"_npmUser":{"name":"ruru_arcade","email":"ruru@3matelabs.com"},"directories":{},"maintainers":[{"name":"easonc13","email":"eason.tw.chen@gmail.com"},{"name":"ruru_arcade","email":"ruru@3matelabs.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/gas-station-sdk_0.3.2_1754124414619_0.31928961939720724"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-01T13:29:58.430Z","modified":"2025-08-02T08:46:55.054Z","0.1.0":"2025-08-01T13:29:58.679Z","0.2.0":"2025-08-01T14:37:43.764Z","0.3.0":"2025-08-01T15:46:34.311Z","0.3.1":"2025-08-01T16:00:49.247Z","0.3.2":"2025-08-02T08:46:54.786Z"},"bugs":{"url":"https://github.com/3MateLabs/gas-station-sdk/issues"},"author":{"name":"3mate Labs"},"license":"MIT","homepage":"https://github.com/3MateLabs/gas-station-sdk#readme","keywords":["sui","iota","blockchain","gas-station","sponsorship","web3","3mate"],"repository":{"type":"git","url":"git+https://github.com/3MateLabs/gas-station-sdk.git"},"description":"Official SDK for 3mate Gas Station - Seamless blockchain transaction sponsorship for SUI and IOTA","maintainers":[{"name":"easonc13","email":"eason.tw.chen@gmail.com"},{"name":"ruru_arcade","email":"ruru@3matelabs.com"}],"readme":"# @3mate/gas-station-sdk\n\nOfficial SDK for [3mate Gas Station](https://gas.movevm.tools) - Seamless blockchain transaction sponsorship for SUI and IOTA networks.\n\n## Installation\n\n```bash\nnpm install @3mate/gas-station-sdk\n# or\nyarn add @3mate/gas-station-sdk\n# or\npnpm add @3mate/gas-station-sdk\n```\n\n## Quick Start\n\n### SUI Transaction Sponsorship\n\n```typescript\nimport { suiSponsorship } from '@3mate/gas-station-sdk';\nimport { Transaction } from '@mysten/sui/transactions';\nimport { toHex, fromHex, toBase64 } from '@mysten/sui/utils';\n\n// Build your transaction\nconst tx = new Transaction();\ntx.setSender(userAddress);\n// ... add your transaction logic\n\n// Get transaction bytes\nconst transactionBytes = await tx.build({ \n  client, \n  onlyTransactionKind: true \n});\n\n// Sponsor the transaction\ntry {\n  const { txBytesHex, sponsorSignature } = await suiSponsorship({\n    apiKey: 'your-sui-api-key',\n    rawTxBytesHex: toHex(transactionBytes),\n    sender: userAddress,\n    network: 'testnet' // or 'mainnet'\n  });\n  \n  // Convert for wallet signing\n  const sponsoredBytes = fromHex(txBytesHex);\n  \n  // Sign with user wallet\n  const userSignature = await wallet.signTransaction({\n    transaction: toBase64(sponsoredBytes)\n  });\n  \n  // Execute with both signatures\n  await client.executeTransactionBlock({\n    transactionBlock: sponsoredBytes,\n    signature: [userSignature.signature, sponsorSignature]\n  });\n} catch (error) {\n  console.error('Sponsorship failed:', error.message);\n}\n```\n\n### IOTA Transaction Sponsorship\n\n```typescript\nimport { iotaSponsorship } from '@3mate/gas-station-sdk';\nimport { toHEX, fromHEX, toB64 } from '@iota/iota-sdk/utils';\n\n// Build your transaction\nconst tx = new Transaction();\ntx.setSender(userAddress);\n// ... add your transaction logic\n\nconst transactionBytes = await tx.build({ \n  client, \n  onlyTransactionKind: true \n});\n\n// Sponsor the transaction\nconst { txBytesHex, sponsorSignature } = await iotaSponsorship({\n  apiKey: 'your-iota-api-key',\n  rawTxBytesHex: toHEX(transactionBytes),\n  sender: userAddress,\n  network: 'mainnet' // or 'testnet'\n});\n\n// Convert for wallet signing\nconst sponsoredBytes = fromHEX(txBytesHex);\n\n// Sign with user wallet\nconst userSignature = await wallet.signTransaction({\n  transaction: toB64(new Uint8Array(sponsoredBytes))\n});\n\n// Execute with both signatures\nawait client.executeTransactionBlock({\n  transactionBlock: sponsoredBytes,\n  signature: [userSignature.signature, sponsorSignature]\n});\n```\n\n## CORS Configuration\n\nThe Gas Station API requires server-side requests. For browser applications, you'll need to set up a proxy:\n\n### Development Setup\n\n#### Vite\n```javascript\n// vite.config.js\nexport default {\n  server: {\n    proxy: {\n      '/api/gas-station': {\n        target: 'https://gas.movevm.tools',\n        changeOrigin: true,\n        rewrite: (path) => path.replace(/^\\/api\\/gas-station/, '/api')\n      }\n    }\n  }\n}\n```\n\n#### Next.js\n```javascript\n// pages/api/gas-station/[...path].js\nexport default async function handler(req, res) {\n  const response = await fetch(\n    `https://gas.movevm.tools/api/${req.query.path.join('/')}`,\n    {\n      method: req.method,\n      headers: {\n        'Content-Type': 'application/json',\n        'x-api-key': req.headers['x-api-key']\n      },\n      body: req.method !== 'GET' ? JSON.stringify(req.body) : undefined\n    }\n  );\n  \n  const data = await response.json();\n  res.status(response.status).json(data);\n}\n```\n\n### Production Setup\n\nFor production, use server-side API routes or serverless functions to proxy requests to the Gas Station API.\n\n## Error Handling\n\nThe SDK provides detailed error messages with guidance:\n\n```typescript\nimport { suiSponsorship, GasStationError } from '@3mate/gas-station-sdk';\n\ntry {\n  const result = await suiSponsorship({...});\n} catch (error) {\n  if (error instanceof GasStationError) {\n    console.error('Status:', error.statusCode);\n    console.error('Message:', error.message);\n    console.error('Details:', error.details);\n    \n    // Handle specific errors\n    switch (error.statusCode) {\n      case 403:\n        // Invalid API key or security violation\n        break;\n      case 400:\n        // Bad request - check transaction format\n        break;\n      case 500:\n        // Server error\n        break;\n    }\n  }\n}\n```\n\n## API Reference\n\n### Functions\n\n#### `suiSponsorship(params: SponsorshipParams): Promise<SponsorshipResponse>`\nSponsor a SUI transaction.\n\n#### `iotaSponsorship(params: SponsorshipParams): Promise<SponsorshipResponse>`\nSponsor an IOTA transaction.\n\n### Types\n\n```typescript\ninterface SponsorshipParams {\n  apiKey: string;         // Your Gas Station API key\n  rawTxBytesHex: string;  // Hex encoded transaction bytes (without 0x prefix)\n  sender: string;         // The sender's address\n  network: 'mainnet' | 'testnet'; // Network environment\n}\n\ninterface SponsorshipResponse {\n  txBytesHex: string;     // Hex encoded sponsored transaction bytes\n  sponsorSignature: string; // Sponsor signature\n}\n```\n\n## Requirements\n\n- Node.js 16+ or modern browser\n- Valid Gas Station API key from [gas.movevm.tools](https://gas.movevm.tools)\n\n## Support\n\n- Documentation: [gas.movevm.tools/docs](https://gas.movevm.tools/docs)\n- Issues: [GitHub Issues](https://github.com/3MateLabs/gas-station-sdk/issues)\n\n## License\n\nMIT","readmeFilename":"README.md"}