{"_id":"@calldatasdk/sdk","name":"@calldatasdk/sdk","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@calldatasdk/sdk","version":"1.0.0","description":"Calldata Network SDK: drive any backend on Ethereum with signed JSON commands carried in transaction calldata. Build, sign and send commands, no wallet connection.","license":"MIT","homepage":"https://calldata.network","keywords":["calldata","ethereum","evm","command bus","signed commands","json","web3","ethers","no wallet connect"],"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"},"./package.json":"./package.json"},"sideEffects":false,"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts --clean --treeshake","prepublishOnly":"npm run build"},"peerDependencies":{"ethers":"^6.0.0"},"devDependencies":{"ethers":"^6.13.4","tsup":"^8.3.5","typescript":"^5.6.3"},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"_id":"@calldatasdk/sdk@1.0.0","_nodeVersion":"24.7.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-SBL2kLgOhcg1X/5H2J9XnYE/C4RZDgq60b/DPJhIKoGHrsLecZoyPFVZ0rwfrHX5soBxjOy2zXJYdfpTgkWQkA==","shasum":"be975d3adbad7a30483edf96aa8f57f545253241","tarball":"https://registry.npmjs.org/@calldatasdk/sdk/-/sdk-1.0.0.tgz","fileCount":8,"unpackedSize":21504,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIEuRRN2fxS3E1k4dMGAcQJR2keExLlHL5IA5Ot2PqOx2AiAHXu6iFmn59s1IZdM1bYa1kE5L8wDlJgz87diDsbWgkA=="}]},"_npmUser":{"name":"calldatanetwork","email":"calldata@vouchaai.com"},"directories":{},"maintainers":[{"name":"calldatanetwork","email":"calldata@vouchaai.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.0.0_1782833072166_0.9322242933863965"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-30T15:24:32.031Z","1.0.0":"2026-06-30T15:24:32.326Z","modified":"2026-06-30T15:24:32.512Z"},"maintainers":[{"name":"calldatanetwork","email":"calldata@vouchaai.com"}],"description":"Calldata Network SDK: drive any backend on Ethereum with signed JSON commands carried in transaction calldata. Build, sign and send commands, no wallet connection.","homepage":"https://calldata.network","keywords":["calldata","ethereum","evm","command bus","signed commands","json","web3","ethers","no wallet connect"],"license":"MIT","readme":"# @calldatasdk/sdk\n\nDrive any backend on Ethereum with **signed JSON commands**. No wallet connection.\n\nCalldata Network turns the Ethereum ledger into a programmable command bus: you put\na small JSON command in a transaction's **calldata** and sign it. A Calldata backend\nscans those transactions, validates them, proves the signer from `tx.from`, and runs\nthe matching handler. Every command is ordered, permanent and auditable.\n\nThis package is the client SDK: build, sign and send commands.\n\n```bash\nnpm install @calldatasdk/sdk ethers\n```\n\n## Quickstart (script / bot / agent)\n\nSign with your own `Wallet` and send. No connection, no session.\n\n```ts\nimport { JsonRpcProvider, Wallet } from 'ethers';\nimport { sendCommand } from '@calldatasdk/sdk';\n\nconst provider = new JsonRpcProvider('https://ethereum-sepolia-rpc.publicnode.com');\nconst signer = new Wallet(process.env.PRIVATE_KEY!, provider);\n\nconst sent = await sendCommand(signer, {\n  controlAddress: '0xCONTROL_ADDRESS_OF_THE_APP',\n  cmd: 'post',\n  args: { text: 'gm, on-chain' },\n});\n\nconsole.log('sent', sent.hash);\nawait sent.wait();\n```\n\n## In the browser (any wallet, still no connect)\n\nBuild the transaction and hand it to a wallet to sign and send. The site never\nholds a session or your keys.\n\n```ts\nimport { buildCommandTransaction } from '@calldatasdk/sdk';\n\nconst tx = buildCommandTransaction({\n  controlAddress: '0xCONTROL_ADDRESS_OF_THE_APP',\n  cmd: 'move',\n  args: { x: 1, y: 2 },\n});\n\nconst sent = await wallet.sendTransaction(tx); // ethers Signer / injected wallet\n```\n\n## The command envelope (v1, frozen)\n\n```jsonc\n{\n  \"v\": 1,                    // protocol version, always 1\n  \"cmd\": \"post\",             // command name, 1..64 chars\n  \"args\": { \"text\": \"gm\" },  // optional, validated per command\n  \"nonce\": \"8f3ad9c1\",       // optional\n  \"exp\": 1719250000          // optional unix seconds, rejected if in the past\n}\n```\n\n```ts\nimport { encodeEnvelope, decodeEnvelope, encodeCommandData } from '@calldatasdk/sdk';\n\nconst json = encodeEnvelope({ cmd: 'post', args: { text: 'gm' } });\nconst data = encodeCommandData(json);   // -> 0x... calldata for the transaction\nconst envelope = decodeEnvelope(json);  // -> { v: 1, cmd: 'post', args: { text: 'gm' } }\n```\n\n## API\n\n- `sendCommand(signer, input)` , build, sign with an ethers Signer, and send. Returns the `TransactionResponse`.\n- `buildCommandTransaction(input)` , build an unsigned `TransactionRequest` (`{ to, data, value }`) to sign with any wallet.\n- `encodeCommandData(json)` / `decodeCommandData(data)` , envelope JSON <-> `0x` calldata.\n- `encodeEnvelope(input)` / `decodeEnvelope(text)` / `isEnvelopeV1(x)` , the v1 envelope.\n- `ENVELOPE_VERSION`, `MAX_COMMAND_BYTES`.\n\n`ethers` (v6) is a peer dependency.\n\n## Notes\n\n- A command transaction is sent **to** the app's control address with the envelope\n  JSON in its calldata. The raw calldata is the message: no contract, no ABI, no event.\n- The signer of the transaction (`tx.from`) is the authenticated caller.\n- Keep payloads small: calldata is paid for per byte, and the envelope is limited to 4096 bytes.\n\nLearn more at [calldata.network](https://calldata.network). MIT licensed.\n","readmeFilename":"README.md","_rev":"1-36152e25ccb184172e3e745767a05feb"}