{"_id":"@0block.io/sdk","_rev":"9-cc5401289e3d71c0fc1fe87bb57b1c3e","name":"@0block.io/sdk","dist-tags":{"latest":"0.6.0"},"versions":{"0.1.0":{"name":"@0block.io/sdk","version":"0.1.0","keywords":["solana","dex","router","swap","0block","transaction-builder","versioned-transactions","address-lookup-tables"],"license":"UNLICENSED","_id":"@0block.io/sdk@0.1.0","maintainers":[{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"}],"dist":{"shasum":"e3c97f4aaf64ef7bf23bd728998354534822e3e2","tarball":"https://registry.npmjs.org/@0block.io/sdk/-/sdk-0.1.0.tgz","fileCount":38,"integrity":"sha512-q2pX2FwpqiOo1Hgc1FONwv00ZvCNdwTRzbKgWEADYs73aywflqQXs2EwHrnJNOUC9KZqA1Jv5Ks8BPnFZJ60tA==","signatures":[{"sig":"MEUCIBn4QLn8Lc38+XEixah0lpIYxuP/0JnVo4l9hM7k9cI4AiEA4IFlJPMyrFxIgBF0MhJgwIlwYKIKtu4Ox871yZ7kNXc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":217660},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"42b6fe93ed2ad786f04fe95a4d409915adfff499","scripts":{"test":"npm run build && node test/smoke.mjs","build":"tsc -p tsconfig.json","prepublishOnly":"npm test"},"_npmUser":{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"},"deprecated":"Incompatible with deployed programs; use >=0.2.0","_npmVersion":"11.5.1","description":"Client-side transaction builder for the 0Block DEX router. Builds unsigned v0 swap transactions entirely offline — tenant-wrapped or direct — with shared address lookup tables, gateway tips, and on-chain fee-event decoding for accounting.","directories":{},"sideEffects":false,"_nodeVersion":"24.6.0","dependencies":{"@solana/web3.js":"^1.98.0","@coral-xyz/anchor":"^0.31.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1783971648400_0.9769246043313904","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@0block.io/sdk","version":"0.2.0","keywords":["solana","dex","router","swap","0block","transaction-builder","versioned-transactions","address-lookup-tables"],"license":"UNLICENSED","_id":"@0block.io/sdk@0.2.0","maintainers":[{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"}],"dist":{"shasum":"e31c7b78cb65ae118e3a23fb9dab314460bea389","tarball":"https://registry.npmjs.org/@0block.io/sdk/-/sdk-0.2.0.tgz","fileCount":40,"integrity":"sha512-0EdE/8xmpoiBk6wRJ2UC6M5LUIW9H+ITZq4b8FOTQaUlc6gf1GElWJCiMClpJEyQDCaS3QVDEQGL4jSkIrnmXA==","signatures":[{"sig":"MEQCICE0lMQeigjyvg62juNoyeQU511SPBnRl+bonN43SD6SAiAOaHNGZvUxQl8mht4dz1Qg1iVXh6bq5g25TOc7GufljA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":259589},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"42b6fe93ed2ad786f04fe95a4d409915adfff499","scripts":{"test":"npm run build && node test/smoke.mjs","build":"tsc -p tsconfig.json","prepublishOnly":"npm test"},"_npmUser":{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"},"_npmVersion":"11.5.1","description":"Client-side transaction builder for the 0Block DEX router. Builds unsigned v0 swap transactions entirely offline — tenant-wrapped or direct — with shared address lookup tables, gateway tips, and on-chain fee-event decoding for accounting.","directories":{},"sideEffects":false,"_nodeVersion":"24.6.0","dependencies":{"@solana/web3.js":"^1.98.0","@coral-xyz/anchor":"^0.31.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.0_1783976276237_0.6363453863047053","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@0block.io/sdk","version":"0.3.0","keywords":["solana","dex","router","swap","0block","transaction-builder","versioned-transactions","address-lookup-tables"],"license":"UNLICENSED","_id":"@0block.io/sdk@0.3.0","maintainers":[{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"}],"dist":{"shasum":"078b8bf85979b64f1074513b589bc943ce5707c7","tarball":"https://registry.npmjs.org/@0block.io/sdk/-/sdk-0.3.0.tgz","fileCount":40,"integrity":"sha512-jiLl/tb51mV7hSUBAfZNxFTYSJwdpN2aixJhvu582GsqtLEqcR8DPeHe32FL+BHbgR9oAstMY86HXPV+wrEfOg==","signatures":[{"sig":"MEUCIQDHIHBQEgopz7DSsZJqEzwlOxJvOKTTmpC84V1meiJqVQIgGqm3u+Or19UH4Lz4WzW+yWajpB26E061MBmvErqVm3s=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":263150},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"09b3e18996b6767617e694d89bac8ad928228b8f","scripts":{"test":"npm run build && node test/smoke.mjs","build":"tsc -p tsconfig.json","prepublishOnly":"npm test"},"_npmUser":{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"},"_npmVersion":"11.5.1","description":"Client-side transaction builder for the 0Block DEX router. Builds unsigned v0 swap transactions entirely offline — tenant-wrapped or direct — with shared address lookup tables, gateway tips, and on-chain fee-event decoding for accounting.","directories":{},"sideEffects":false,"_nodeVersion":"24.6.0","dependencies":{"@solana/web3.js":"^1.98.0","@coral-xyz/anchor":"^0.31.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.3.0_1783982150875_0.7753160614037811","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@0block.io/sdk","version":"0.4.0","keywords":["solana","dex","router","swap","0block","transaction-builder","versioned-transactions","address-lookup-tables"],"license":"UNLICENSED","_id":"@0block.io/sdk@0.4.0","maintainers":[{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"}],"dist":{"shasum":"02390d0061c5d2e3a2ef0506daf639c93a2898a4","tarball":"https://registry.npmjs.org/@0block.io/sdk/-/sdk-0.4.0.tgz","fileCount":42,"integrity":"sha512-uakLV5nvAoXBXVkduBmV3cQCPDpvV7QOnMYFXJGoghLb4BGLDE6oetMSQOuUzYn/U5KDwK917NKfajUpvUiaxw==","signatures":[{"sig":"MEYCIQD9PScisLIi1Sh0Rdnfo/qyWUTOyA1a3TDpo2nw9R/sIgIhAIvenibbWEzrAv8v4Ep92qDcXm20DB29FZ8jboCapFDN","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":265080},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"aec52b3505f785fec961b306656c73717af7021d","scripts":{"test":"npm run build && node test/smoke.mjs","build":"tsc -p tsconfig.json","prepublishOnly":"npm test"},"_npmUser":{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"},"_npmVersion":"11.5.1","description":"Client-side transaction builder for the 0Block DEX router. Builds unsigned v0 swap transactions entirely offline — tenant-wrapped or direct — with shared address lookup tables, gateway tips, and on-chain fee-event decoding for accounting.","directories":{},"sideEffects":false,"_nodeVersion":"24.6.0","dependencies":{"@solana/web3.js":"^1.98.0","@coral-xyz/anchor":"^0.31.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.4.0_1783993431817_0.41312723049340705","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@0block.io/sdk","version":"0.4.1","keywords":["solana","dex","router","swap","0block","transaction-builder","versioned-transactions","address-lookup-tables"],"license":"UNLICENSED","_id":"@0block.io/sdk@0.4.1","maintainers":[{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"}],"dist":{"shasum":"31267bb299f07b9d5252a50cc2c0db6c2e56012a","tarball":"https://registry.npmjs.org/@0block.io/sdk/-/sdk-0.4.1.tgz","fileCount":42,"integrity":"sha512-UGZiOJI0RfirNrh8rMJY/+5IOzVRK/LWNdb1FHjlRpMfyD5ys/+D9ZgCmEN6GlDPFt20O8wovCcKGQ8s1BNx1Q==","signatures":[{"sig":"MEQCIB/ZM78hCuZgEbI0GIZMuwUO6vjIXngtcmQ0P9b6F6d6AiANVRk8/vI6OGDKXyAFeGBH5OC/CZmpzaT/QIhuS+CGzg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":266046},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"2f13f502abbc40caf14f04436aa7250d649d42d1","scripts":{"test":"npm run build && node test/smoke.mjs","build":"tsc -p tsconfig.json","prepublishOnly":"npm test"},"_npmUser":{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"},"_npmVersion":"11.5.1","description":"Client-side transaction builder for the 0Block DEX router. Builds unsigned v0 swap transactions entirely offline — tenant-wrapped or direct — with shared address lookup tables, gateway tips, and on-chain fee-event decoding for accounting.","directories":{},"sideEffects":false,"_nodeVersion":"24.6.0","dependencies":{"@solana/web3.js":"^1.98.0","@coral-xyz/anchor":"^0.31.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.4.1_1783993937435_0.4836853397806993","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@0block.io/sdk","version":"0.5.0","keywords":["solana","dex","router","swap","0block","transaction-builder","versioned-transactions","address-lookup-tables"],"license":"UNLICENSED","_id":"@0block.io/sdk@0.5.0","maintainers":[{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"}],"dist":{"shasum":"72611f41831c768c2714fa6cab51d9537f0d2bd4","tarball":"https://registry.npmjs.org/@0block.io/sdk/-/sdk-0.5.0.tgz","fileCount":44,"integrity":"sha512-w1ecPsRoqePWNjUoJHWsMJQpO8ar4NJA7zJ0CE+WFvlxmanynP1BDqyNOzM9yIyKs+t9RXlL4WrwKBE4unUEMA==","signatures":[{"sig":"MEQCIA+IzGsZCjB0s5nRPrvCCkZGv0nYU3FfJkzRcmg0crgQAiAfR2DSgvMkq0jI/uMtG6lzkM4Iyww4akZBR0aAHuMl2A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":273729},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"b91469d5cd9d7fdebbd3bd0246ffec84e83aebb2","scripts":{"test":"npm run build && node test/smoke.mjs","build":"tsc -p tsconfig.json","prepublishOnly":"npm test"},"_npmUser":{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"},"_npmVersion":"11.5.1","description":"Client-side transaction builder for the 0Block DEX router. Builds unsigned v0 swap transactions entirely offline — tenant-wrapped or direct — with shared address lookup tables, gateway tips, and on-chain fee-event decoding for accounting.","directories":{},"sideEffects":false,"_nodeVersion":"24.6.0","dependencies":{"@solana/web3.js":"^1.98.0","@coral-xyz/anchor":"^0.31.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.5.0_1783996664398_0.829406347990763","host":"s3://npm-registry-packages-npm-production"}},"0.5.1":{"name":"@0block.io/sdk","version":"0.5.1","keywords":["solana","dex","router","swap","0block","transaction-builder","versioned-transactions","address-lookup-tables"],"license":"UNLICENSED","_id":"@0block.io/sdk@0.5.1","maintainers":[{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"}],"dist":{"shasum":"c55c234203a1b286ad81659d00a6422deae71923","tarball":"https://registry.npmjs.org/@0block.io/sdk/-/sdk-0.5.1.tgz","fileCount":44,"integrity":"sha512-T2i/wriDAJRiM0QskyxtQhZcs57R3j4GGR+6KSgOhPzzCMkDSzGu2umSOzRBqO4kceoI9tGH3y9qBe7S3Dpssw==","signatures":[{"sig":"MEUCIBwQUU/SyW7gEBpTpOZfhatZPH044sCQayCuz5QOIlRXAiEAuTcAHNsHzn8eWehN5r9sAj9eegjz2EkhDj3rg2ZSvho=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":275579},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"1c568c6bfb3e49592f6ea5f8ac1b0acdfb89482a","scripts":{"test":"npm run build && node test/smoke.mjs","build":"tsc -p tsconfig.json","prepublishOnly":"npm test"},"_npmUser":{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"},"_npmVersion":"11.5.1","description":"Client-side transaction builder for the 0Block DEX router. Builds unsigned v0 swap transactions entirely offline — tenant-wrapped or direct — with shared address lookup tables, gateway tips, and on-chain fee-event decoding for accounting.","directories":{},"sideEffects":false,"_nodeVersion":"24.6.0","dependencies":{"@solana/web3.js":"^1.98.0","@coral-xyz/anchor":"^0.31.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.5.1_1783998187327_0.24377222329698767","host":"s3://npm-registry-packages-npm-production"}},"0.6.0":{"name":"@0block.io/sdk","version":"0.6.0","description":"Client-side transaction builder for the 0Block DEX router. Builds unsigned v0 swap transactions entirely offline — tenant-wrapped or direct — with shared address lookup tables, gateway tips, and on-chain fee-event decoding for accounting.","keywords":["solana","dex","router","swap","0block","transaction-builder","versioned-transactions","address-lookup-tables"],"license":"UNLICENSED","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"sideEffects":false,"engines":{"node":">=20"},"publishConfig":{"access":"public"},"scripts":{"build":"tsc -p tsconfig.json","test":"npm run build && node test/smoke.mjs","prepublishOnly":"npm test"},"dependencies":{"@coral-xyz/anchor":"^0.31.1","@solana/web3.js":"^1.98.0"},"devDependencies":{"typescript":"^5.5.4"},"_id":"@0block.io/sdk@0.6.0","gitHead":"8bd1c10c861abc3fc0242161ccaa99b4879e21fe","_nodeVersion":"24.6.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-ba3UDFVLm2aCat3gwkkr8BbiLjJd6JueZ+7c6/FoJWA0CF88/DxS8eHafOfB8U4PKXHk0yrN1tfuBWFURB+c3g==","shasum":"28a586f18369b54b92fb353e42d7b3472932151e","tarball":"https://registry.npmjs.org/@0block.io/sdk/-/sdk-0.6.0.tgz","fileCount":44,"unpackedSize":280033,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC4w9HPff0Ynv5RF+dyd8r6eMhRoYMve6RiwWWqLq0N3AIgRzFPsFxW12he1Wb7B3c6+i2WS9abNuWPCYkdawhVfVo="}]},"_npmUser":{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"},"directories":{},"maintainers":[{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.6.0_1783998732498_0.8542827740951338"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-13T19:40:48.129Z","modified":"2026-07-14T03:12:12.757Z","0.1.0":"2026-07-13T19:40:48.554Z","0.2.0":"2026-07-13T20:57:56.374Z","0.3.0":"2026-07-13T22:35:51.008Z","0.4.0":"2026-07-14T01:43:51.956Z","0.4.1":"2026-07-14T01:52:17.563Z","0.5.0":"2026-07-14T02:37:44.576Z","0.5.1":"2026-07-14T03:03:07.481Z","0.6.0":"2026-07-14T03:12:12.641Z"},"license":"UNLICENSED","keywords":["solana","dex","router","swap","0block","transaction-builder","versioned-transactions","address-lookup-tables"],"description":"Client-side transaction builder for the 0Block DEX router. Builds unsigned v0 swap transactions entirely offline — tenant-wrapped or direct — with shared address lookup tables, gateway tips, and on-chain fee-event decoding for accounting.","maintainers":[{"name":"sofiane-nyxl","email":"sofiane@nyxl.io"}],"readme":"# @0block.io/sdk\n\n[![npm version](https://img.shields.io/npm/v/%400block.io%2Fsdk.svg)](https://www.npmjs.com/package/@0block.io/sdk)\n[![types](https://img.shields.io/npm/types/%400block.io%2Fsdk.svg)](https://www.npmjs.com/package/@0block.io/sdk)\n\n**The SDK for 0Block's two products — independent, composable:**\n\n| Product | What it does | Needs the other? |\n|---|---|---|\n| **DEX Smart Router** | Build swap transactions on-chain-routed across 60+ venues — through your tenant wrapper (your fee applies) or directly (0Block fee only) | No — submit through any RPC |\n| **Landing Service** | Land **any** fully-signed Solana transaction: tip-gated submission forwarded to staked infrastructure and current/next leader TPUs | No — accepts any transaction |\n\nUsed together they form a complete trade pipeline: build with the router SDK,\nsign externally, land through the service.\n\n**Router highlights:**\n\n- **Zero network calls at trade time.** Market context, lookup tables, and a\n  blockhash are resolved once server-side and streamed; the client assembles\n  the transaction synchronously.\n- **One signature.** The end user is the only required signer, in both modes.\n- **Fees are on-chain, not inputs.** Tenant and platform commissions are read\n  and enforced by the programs; the SDK never accepts a fee parameter.\n- **SOL-native UX, program-managed.** In tenant mode the wrapper wraps/unwraps\n  and cleans up token accounts on-chain — clients never touch wSOL.\n- **External-signer native.** Returns the exact message bytes to sign, for\n  wallets, signing services, or HSMs — no `Keypair` ever touches the SDK.\n\n## Installation\n\n```sh\nnpm install @0block.io/sdk\n```\n\nRequires Node ≥ 20 server-side; browser builds work with any modern bundler.\n\n## Modes\n\nThe mode is fixed at initialization:\n\n```ts\nimport { createContext } from \"@0block.io/sdk\";\n\n// Tenant mode — swaps route through your tenant wrapper program.\n// Your tenant fee (set on-chain) and the 0Block fee apply.\nconst ctx = createContext({\n  tenant: {\n    wrapperProgramId: \"<your tenant wrapper program id>\",\n    tenantFeeVault: \"<your tenant fee vault>\",\n  },\n});\n\n// Direct mode — swaps invoke the 0Block router directly.\n// Only the 0Block platform fee applies.\nconst ctx = createContext();\n```\n\n## Quick start\n\n### 1. Backend — resolve market context once, stream it\n\n```ts\nimport { connectionFetcher, resolvePumpfunMarketContext } from \"@0block.io/sdk\";\n\nconst fetcher = connectionFetcher(connection);\nconst market = await resolvePumpfunMarketContext(fetcher, { mint });\n// `market` is plain strings — push it to clients over your existing\n// stream together with quotes and a FINALIZED blockhash.\n```\n\n### 2. Backend ops — shared lookup table, once per venue set\n\n```ts\nimport {\n  buildLookupTableAddresses,\n  buildInitLookupTableInstructions,\n} from \"@0block.io/sdk\";\n\nconst addresses = buildLookupTableAddresses({ context: ctx, market });\nconst { tableAddress, transactions } = buildInitLookupTableInstructions({\n  authority: opsKey,\n  recentSlot,\n  addresses,\n});\n// Send each batch as one transaction, in order. Wait ~1 slot before first use.\n```\n\n### 3. Client — preset → unsigned transaction → your signer\n\n```ts\nimport { applyPreset, buildPumpfunSwapTransaction } from \"@0block.io/sdk\";\n\nconst { minReturn, tip, computeBudget } = applyPreset(\n  { slippagePct: 20, prioritySol: 0.001, bribeSol: 0.001 },\n  { expectedOut: quote.expectedOut, tipAccount: streamed.tipAccount }\n);\n\nconst built = buildPumpfunSwapTransaction({\n  context: ctx,\n  market,\n  user: wallet.address,\n  side: \"buy\",\n  amountIn: 10_000_000n, // 0.01 SOL\n  minReturn,\n  recentBlockhash: streamed.finalizedBlockhash,\n  lookupTables: streamed.lookupTables,\n  tip,\n  computeBudget,\n});\n\n// built.messageBytes  → sign with the user's key (exactly one signature)\n// built.orderId       → correlate the fill via SwapResultEvent\n// built.estimatedSize → wire size, pre-checked against the 1232-byte limit\n```\n\nAttach the signature and get wire bytes with `serializeWithSignatures(built, [sig])`,\nthen submit through the 0Block gateway.\n\n### 4. Indexer — fee accounting from confirmed transactions\n\n```ts\nimport { decodeSwapResultEvents } from \"@0block.io/sdk\";\n\nconst events = decodeSwapResultEvents(tx.meta.logMessages);\n// [{ orderId, status, commissions: { feeMint, totalFeeAmount,\n//    items: [{ kind: \"platform\" | \"tenant\", bps, amount, tenantProgram }] } }]\n```\n\n## Landing Service (standalone)\n\nLand any transaction — router-built or otherwise. Three rules: include the\ntip (a plain transfer to an allowlisted account, kept as a **static** message\nkey, never behind a lookup table), use a **finalized** blockhash, and confirm\nby **polling** (no websocket).\n\n```ts\nimport { createLandingClient, withLandingTip } from \"@0block.io/sdk\";\n\n// Any instructions at all — no router required:\nconst ixs = withLandingTip(myInstructions, payer, {\n  account: tipAccount,          // allowlisted tip account\n  lamports: 1_000_000n,         // ≥ the service minimum\n});\n// ...compile with a FINALIZED blockhash, sign...\n\nconst landing = createLandingClient({\n  url: \"https://<landing-endpoint>\",\n  apiKey: process.env.ZEROBLOCK_API_KEY,\n});\nconst { signature, slot } = await landing.submitAndConfirm(wireBytes, readConnection, {\n  lastValidBlockHeight,\n});\n```\n\nRouter-built transactions already carry the tip when you pass `tip` to\n`buildPumpfunSwapTransaction` — hand their signed wire bytes straight to\n`landing.sendTransaction`.\n\n## API overview\n\n| Runs | Function | Purpose |\n|---|---|---|\n| anywhere | `createContext` | Resolve tenant vs direct mode from init params |\n| backend | `resolvePumpfunMarketContext` | Chain-derived accounts for a mint, as streamable strings |\n| backend | `buildLookupTableAddresses` / `buildInitLookupTableInstructions` | Create the shared static-accounts table |\n| client | `applyPreset` | Slippage % / priority SOL / bribe SOL → build params |\n| client | `buildPumpfunSwapTransaction` | Complete unsigned v0 transaction (offline) |\n| client | `serializeWithSignatures` | Attach external signatures → wire bytes |\n| indexer | `decodeSwapResultEvents` | `SwapResultEvent` → normalized commission breakdown |\n\nLower-level building blocks (`buildPumpfunSwapInstruction`, PDA derivations,\nwSOL wrap/unwrap helpers, tip and compute-budget builders, vendored IDLs) are\nexported as well.\n\n## Operational notes\n\n- **Order ids are server-authoritative in tenant mode.** The wrapper enforces\n  an exactly-once replay gate keyed by `(payer, order_id)`: a duplicate order\n  id fails at account creation and the whole swap reverts. Mint `orderId` on\n  your backend (non-zero u128, one per business order — reuse it across\n  retries) and pass it to `buildPumpfunSwapTransaction`; the SDK refuses to\n  build tenant swaps without one. Direct mode has no marker; a random id is\n  generated when omitted.\n- **Tenant mode prerequisites.** Your wrapper must be the build in which the\n  `wrapper_config` PDA signs the router CPI, and the router's\n  `TenantConfig.tenant_authority` must equal that PDA\n  (`deriveWrapperConfig(wrapperProgramId)`). Otherwise swaps fail\n  `UnauthorizedTenant`.\n- **Direct mode prerequisite.** The router requires *a* `TenantConfig` account\n  in the `tenant_cfg` slot even on direct calls (ignored for fees). The router\n  operator provisions a standing \"direct\" config; override its key with\n  `directTenantConfigKey` if needed.\n- **Tips must stay static message keys.** The gateway verifies the tip transfer\n  on raw bytes without resolving lookup tables. The builder masks tip accounts\n  out of table copies defensively — never add tip accounts to an ALT.\n- **Use a FINALIZED blockhash.** The gateway forwards to a different staked\n  node; a `confirmed` hash may be unknown there.\n- **Native SOL handling.** Buys wrap SOL → wSOL in-transaction (idempotent ATA\n  + transfer + SyncNative); sells close the wSOL ATA back to SOL. Opt out with\n  `wrapSol` / `unwrapWsol` if your users manage wSOL themselves.\n- **Venue coverage.** v1 ships the pump.fun bonding-curve venue (buy/sell,\n  single hop). Additional venues follow the same shape — one\n  remaining-accounts builder per venue.\n\n## Development\n\n```sh\nnpm install\nnpm test   # compiles, then runs the offline smoke test (no network, no keys)\n```\n\nThe vendored IDLs under `src/idl/` are generated from the on-chain programs'\nAnchor builds. Regenerate them after any program change — account ordering and\ndiscriminators must match on-chain reality.\n\n## License\n\nUNLICENSED — all rights reserved. Contact 0block.io for usage terms.\n","readmeFilename":"README.md"}