{"_id":"@0xkey-io/viem","_rev":"3-d13fa7991df20b34a3d2c45b52da2fda","name":"@0xkey-io/viem","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@0xkey-io/viem","version":"0.1.0","keywords":["0xkey","Viem","custom account","account","wallet","signer"],"author":{"url":"https://0xkey.com/","name":"0xkey"},"license":"Apache-2.0","_id":"@0xkey-io/viem@0.1.0","maintainers":[{"name":"0xkey-developer","email":"developer@0xkey.io"}],"homepage":"https://github.com/0xkey-io/sdk-js/tree/main/packages/viem","bugs":{"url":"https://github.com/0xkey-io/sdk-js/issues"},"dist":{"shasum":"a9fb1ac1e5cfa54973ba42e9db46c4fbcc599553","tarball":"https://registry.npmjs.org/@0xkey-io/viem/-/viem-0.1.0.tgz","fileCount":10,"integrity":"sha512-iOUE71tetPx1HE31r+dGIrNB/OgaQ03/MhM9qfgsmR5misdPq7RFxf4soykXG6R1RG8rtJCWRSlgXj9P6VmGBg==","signatures":[{"sig":"MEUCIFuxkYA+e/wvMmMleNJfCGbom2c1w5Mqqa7x+kpw/krQAiEA4w9uqNWgEz8G5STotOUDDzAygSrX4GbZI2M+A7DOf+E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":75846},"main":"./dist/index.js","_from":"file:0xkey-io-viem-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","default":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"test":"jest --detectOpenHandles","anvil":"anvil","build":"rollup -c","clean":"rimraf ./dist ./.cache","typecheck":"tsc -p tsconfig.typecheck.json","compile:contracts":"hardhat compile"},"_npmUser":{"name":"0xkey-developer","email":"developer@0xkey.io"},"_resolved":"/private/var/folders/lf/b69416ms3zvccf0ght6bq02r0000gn/T/c2f06525d1347a7563b8ba2530c171ea/0xkey-io-viem-0.1.0.tgz","_integrity":"sha512-iOUE71tetPx1HE31r+dGIrNB/OgaQ03/MhM9qfgsmR5misdPq7RFxf4soykXG6R1RG8rtJCWRSlgXj9P6VmGBg==","repository":{"url":"git+https://github.com/0xkey-io/sdk-js.git","type":"git","directory":"packages/viem"},"_npmVersion":"11.4.2","description":"0xkey Helpers to work with Viem","directories":{},"_nodeVersion":"24.3.0","dependencies":{"cross-fetch":"^4.0.0","@noble/curves":"1.8.0","@0xkey-io/core":"0.1.0","@0xkey-io/http":"0.1.0","@0xkey-io/sdk-server":"0.1.0","@0xkey-io/sdk-browser":"0.1.0","@openzeppelin/contracts":"^5.0.2","@0xkey-io/api-key-stamper":"0.1.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.3.1","viem":"^2.24.2","typescript":"5.4.3","@types/jest":"^29.5.3"},"peerDependencies":{"viem":"^1.16.6 || ^2.24.2"},"_npmOperationalInternal":{"tmp":"tmp/viem_0.1.0_1779443609187_0.020205572159674556","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@0xkey-io/viem","version":"0.1.1","keywords":["0xkey","Viem","custom account","account","wallet","signer"],"author":{"url":"https://0xkey.com/","name":"0xkey"},"license":"Apache-2.0","_id":"@0xkey-io/viem@0.1.1","maintainers":[{"name":"0xkey-developer","email":"developer@0xkey.io"}],"homepage":"https://github.com/0xkey-io/sdk-js/tree/main/packages/viem","bugs":{"url":"https://github.com/0xkey-io/sdk-js/issues"},"dist":{"shasum":"28d4bcfd6b2afd1b2ba5eec75a758b37f86cff76","tarball":"https://registry.npmjs.org/@0xkey-io/viem/-/viem-0.1.1.tgz","fileCount":10,"integrity":"sha512-egs5hU14w0o+CS9LLfjY1H5/6+M245A7eYxA0w+oAtGFDJsx2hqyagNVpWhSwe5vC23oS4FwWG7dmVI5Cf/gJQ==","signatures":[{"sig":"MEUCIH15kYpb58Qsm8a/7/IiwCl3wvpiaWS+uByn5kvPePMVAiEA1VgWywlIkOLjIZA8TfVpT2c8Meg4Dy0Lwf48FMg6+vg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":76052},"main":"./dist/index.js","_from":"file:0xkey-io-viem-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","default":"./dist/index.mjs","require":"./dist/index.js"}},"scripts":{"test":"jest --detectOpenHandles","anvil":"anvil","build":"rollup -c","clean":"rimraf ./dist ./.cache","typecheck":"tsc -p tsconfig.typecheck.json","compile:contracts":"hardhat compile"},"_npmUser":{"name":"0xkey-developer","email":"developer@0xkey.io"},"_resolved":"/private/var/folders/lf/b69416ms3zvccf0ght6bq02r0000gn/T/284b1abe4d069c937cc0099947313fb8/0xkey-io-viem-0.1.1.tgz","_integrity":"sha512-egs5hU14w0o+CS9LLfjY1H5/6+M245A7eYxA0w+oAtGFDJsx2hqyagNVpWhSwe5vC23oS4FwWG7dmVI5Cf/gJQ==","repository":{"url":"git+https://github.com/0xkey-io/sdk-js.git","type":"git","directory":"packages/viem"},"_npmVersion":"11.4.2","description":"0xkey Helpers to work with Viem","directories":{},"_nodeVersion":"24.3.0","dependencies":{"cross-fetch":"^4.0.0","@noble/curves":"1.8.0","@0xkey-io/core":"0.1.1","@0xkey-io/http":"0.1.1","@0xkey-io/sdk-server":"0.1.1","@0xkey-io/sdk-browser":"0.1.1","@openzeppelin/contracts":"^5.0.2","@0xkey-io/api-key-stamper":"0.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.3.1","viem":"^2.24.2","typescript":"5.4.3","@types/jest":"^29.5.3"},"peerDependencies":{"viem":"^1.16.6 || ^2.24.2"},"_npmOperationalInternal":{"tmp":"tmp/viem_0.1.1_1779452065719_0.6556916685027363","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@0xkey-io/viem","version":"0.1.3","main":"./dist/index.js","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js","default":"./dist/index.mjs"}},"types":"./dist/index.d.ts","license":"Apache-2.0","description":"0xkey Helpers to work with Viem","keywords":["0xkey","Viem","custom account","account","wallet","signer"],"author":{"name":"0xkey","url":"https://0xkey.com/"},"homepage":"https://github.com/0xkey-io/sdk-js/tree/main/packages/viem","bugs":{"url":"https://github.com/0xkey-io/sdk-js/issues"},"repository":{"type":"git","url":"git+https://github.com/0xkey-io/sdk-js.git","directory":"packages/viem"},"publishConfig":{"access":"public"},"peerDependencies":{"viem":"^1.16.6 || ^2.24.2"},"dependencies":{"@noble/curves":"1.8.0","@openzeppelin/contracts":"^5.0.2","cross-fetch":"^4.0.0","@0xkey-io/api-key-stamper":"0.1.2","@0xkey-io/sdk-browser":"0.1.2","@0xkey-io/http":"0.1.2","@0xkey-io/core":"0.2.0","@0xkey-io/sdk-server":"0.1.2"},"devDependencies":{"@types/jest":"^29.5.3","jest":"^29.3.1","typescript":"5.4.3","viem":"^2.24.2"},"engines":{"node":">=18.0.0"},"scripts":{"build":"rollup -c","clean":"rimraf ./dist ./.cache","test":"jest --detectOpenHandles","anvil":"anvil","typecheck":"tsc -p tsconfig.typecheck.json","compile:contracts":"hardhat compile"},"_id":"@0xkey-io/viem@0.1.3","_integrity":"sha512-g8wIIOiQawzLgBRTFsxKX17Fl7xstz5pzde6+OhheDey7yawY3/aZqKQOTkIAVgurF8Ku7coi1Qn+5zVQS5pEQ==","_resolved":"/tmp/2d0211828742a9da18c90b52cf2f9393/0xkey-io-viem-0.1.3.tgz","_from":"file:0xkey-io-viem-0.1.3.tgz","_nodeVersion":"20.17.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-g8wIIOiQawzLgBRTFsxKX17Fl7xstz5pzde6+OhheDey7yawY3/aZqKQOTkIAVgurF8Ku7coi1Qn+5zVQS5pEQ==","shasum":"ca0b6addab8907770f0e4d1b308c9e3195453486","tarball":"https://registry.npmjs.org/@0xkey-io/viem/-/viem-0.1.3.tgz","fileCount":10,"unpackedSize":80979,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHj+wgUE76q8rWBpJmeLbbj+f7e6XXAeAsVeN/3mWDJmAiEA3pjBj1koB6czHUOANjvSsexd5KaxqEkHWJZcmCbWWks="}]},"_npmUser":{"name":"0xkey-developer","email":"developer@0xkey.io"},"directories":{},"maintainers":[{"name":"0xkey-developer","email":"developer@0xkey.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/viem_0.1.3_1782244243973_0.4410106856709457"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-22T09:53:29.059Z","modified":"2026-06-23T19:50:44.261Z","0.1.0":"2026-05-22T09:53:29.321Z","0.1.1":"2026-05-22T12:14:25.946Z","0.1.3":"2026-06-23T19:50:44.109Z"},"bugs":{"url":"https://github.com/0xkey-io/sdk-js/issues"},"author":{"name":"0xkey","url":"https://0xkey.com/"},"license":"Apache-2.0","homepage":"https://github.com/0xkey-io/sdk-js/tree/main/packages/viem","keywords":["0xkey","Viem","custom account","account","wallet","signer"],"repository":{"type":"git","url":"git+https://github.com/0xkey-io/sdk-js.git","directory":"packages/viem"},"description":"0xkey Helpers to work with Viem","maintainers":[{"name":"0xkey-developer","email":"developer@0xkey.io"}],"readme":"# @0xkey-io/viem\n\n[![npm](https://img.shields.io/npm/v/@0xkey-io/viem?color=%234C48FF)](https://www.npmjs.com/package/@0xkey-io/viem)\n\nThis package contains helpers to use [Viem](https://viem.sh/) with [ZeroXKey](https://0xkey.com).\n\nWe provide a ZeroXKey [Custom Account](https://viem.sh/docs/accounts/custom.html#custom-account) (signer) which implements the signing APIs expected by Viem clients.\n\nIf you need a lower-level, fully typed HTTP client for interacting with ZeroXKey API, check out [`@0xkey-io/http`](https://www.npmjs.com/package/@0xkey-io/http).\n\n## Getting started\n\n```bash\n$ npm install viem @0xkey-io/viem\n```\n\n```typescript\nimport { createAccount } from \"@0xkey-io/viem\";\nimport { ZeroXKeyClient } from \"@0xkey-io/http\";\nimport { ApiKeyStamper } from \"@0xkey-io/api-key-stamper\";\nimport { createWalletClient, http } from \"viem\";\nimport { sepolia } from \"viem/chains\";\n\nasync function main() {\n  // Create a ZeroXKey HTTP client with API key credentials\n  const httpClient = new ZeroXKeyClient(\n    {\n      baseUrl: \"https://api.0xkey.com\",\n    },\n    // This uses API key credentials.\n    // If you're using passkeys, use `@0xkey-io/webauthn-stamper` to collect webauthn signatures:\n    // new WebauthnStamper({...options...})\n    new ApiKeyStamper({\n      apiPublicKey: \"...\",\n      apiPrivateKey: \"...\",\n    }),\n  );\n\n  // Create the Viem custom account\n  const zeroXKeyAccount = await createAccount({\n    client: httpClient,\n    organizationId: \"...\",\n    signWith: \"...\",\n    // optional; will be fetched from ZeroXKey if not provided\n    ethereumAddress: \"...\",\n  });\n\n  // Below: standard Viem APIs are used, nothing special!\n\n  const client = createWalletClient({\n    account: zeroXKeyAccount,\n    chain: sepolia,\n    transport: http(`https://sepolia.infura.io/v3/$(YOUR_INFURA_API_KEY)`),\n  });\n\n  const transactionRequest = {\n    to: \"0x08d2b0a37F869FF76BACB5Bab3278E26ab7067B7\" as `0x${string}`,\n    value: 1000000000000000n, // 0.001 ETH\n  };\n\n  const txHash = await client.sendTransaction(transactionRequest);\n  console.log(`Success! Transaction broadcast with hash ${txHash}`);\n}\n\nmain().catch((error) => {\n  console.error(error);\n  process.exit(1);\n});\n```\n\n## Testing (Local)\n\n1. Copy `.env.example` to `.env`\n\n   ```bash\n   $ cp .env.example .env\n   ```\n\n2. Start the Anvil node in one shell:\n   - Install [Foundry](https://book.getfoundry.sh/getting-started/installation) & Anvil if you haven't done so already\n   - Add Foundry to your `$PATH`\n     ```bash\n     $ export PATH=\"$PATH:$HOME/.foundry/bin\"\n     ```\n   - Source your env e.g.\n     ```bash\n     $ source ~/.zshrc\n     ```\n   - Run `foundryup` to install `Anvil`\n     ```bash\n     $ foundryup\n     ```\n   - Start Anvil\n     ```\n     $ pnpm anvil\n     ```\n\n3. Run the tests in a new shell:\n\n   ```\n   $ pnpm test\n   ```\n\n## See also\n\n- [`@0xkey-io/example-with-viem`](https://github.com/0xkey-io/sdk-js/tree/main/examples/with-viem): example using this package to create, sign, and broadcast a transaction on Sepolia (Ethereum testnet)\n- [`@0xkey-io/http`](https://www.npmjs.com/package/@0xkey-io/http): lower-level fully typed HTTP client for interacting with ZeroXKey API\n- [`@0xkey-io/api-key-stamper`](https://www.npmjs.com/package/@0xkey-io/api-key-stamper): package to authenticate to ZeroXKey using API key credentials\n- [`@0xkey-io/webauthn-stamper`](https://www.npmjs.com/package/@0xkey-io/webauthn-stamper): package to authenticate to ZeroXKey using Webauthn/passkeys.\n\n## Transaction types supported\n\n- ZeroXKey's Viem implementation now supports all transaction types: legacy, EIP-2930 (Type 1), EIP-1559 (Type 2), EIP-4844 (Type 3), and EIP-7702 (Type 4). See [with-viem](https://github.com/0xkey-io/sdk-js/tree/main/examples/with-viem/) for examples of scripts that sign using those various types.\n","readmeFilename":"README.md"}