{"_id":"@droplinked_inc/web3-kit","_rev":"4-814c39dbe69373a22762d51e9733215c","name":"@droplinked_inc/web3-kit","dist-tags":{"latest":"2.0.1"},"versions":{"0.1.0":{"name":"@droplinked_inc/web3-kit","version":"0.1.0","license":"MIT","_id":"@droplinked_inc/web3-kit@0.1.0","maintainers":[{"name":"droplinked_inc","email":"ali@droplinked.com"}],"homepage":"https://github.com/droplinked/droplink-packages#readme","bugs":{"url":"https://github.com/droplinked/droplink-packages/issues"},"dist":{"shasum":"5840b7c6804395603229d45a9392e591292e4195","tarball":"https://registry.npmjs.org/@droplinked_inc/web3-kit/-/web3-kit-0.1.0.tgz","fileCount":37,"integrity":"sha512-XzqI4knqiIJI/zQx9hTRWBecWmoQOLxs2t9OlYFyCQUQPYGeSLZCtE7JM2CX1TH/dzpglvipD9ONpzkSToZL9A==","signatures":[{"sig":"MEUCIEwzonpVmzfrMz+nTxIv8mT5IirVPwgClrE3L3Oijxg5AiEAgSDYINXTcUl88VP6whFJeXQrBOwV2yA+sDBfKGfHdf4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":120360},"main":"./dist/index.js","type":"module","_from":"file:droplinked_inc-web3-kit-0.1.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"lint":"eslint src --max-warnings=0","test":"jest","build":"tsc -p tsconfig.json","typecheck":"tsc --noEmit -p tsconfig.json","test:coverage":"jest --coverage"},"_npmUser":{"name":"droplinked_inc","email":"ali@droplinked.com"},"_resolved":"/tmp/b3a5fdb2cbb2a0d853e5c3536a96e75c/droplinked_inc-web3-kit-0.1.0.tgz","_integrity":"sha512-XzqI4knqiIJI/zQx9hTRWBecWmoQOLxs2t9OlYFyCQUQPYGeSLZCtE7JM2CX1TH/dzpglvipD9ONpzkSToZL9A==","repository":{"url":"git+https://github.com/droplinked/droplink-packages.git","type":"git","directory":"packages/web3-kit"},"_npmVersion":"10.9.7","description":"Higher-level web3 building blocks (chain registry, known-token registry, display formatters, tx builders) — hardened rebuild of the original droplinked-web3-kit@1.0.13.","directories":{},"sideEffects":false,"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.23.8","viem":"^2.21.0"},"publishConfig":{"access":"public","provenance":false},"_hasShrinkwrap":false,"devDependencies":{"fast-check":"^3.22.0","typescript":"^5.6.0","@types/jest":"^29.5.12","@types/node":"^22.5.0","@droplinked_inc/wallet-connection":"0.1.1"},"peerDependencies":{"@droplinked_inc/wallet-connection":"0.1.1"},"_npmOperationalInternal":{"tmp":"tmp/web3-kit_0.1.0_1779168342990_0.8017420019475845","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@droplinked_inc/web3-kit","version":"1.0.0","license":"MIT","_id":"@droplinked_inc/web3-kit@1.0.0","maintainers":[{"name":"droplinked_inc","email":"ali@droplinked.com"}],"homepage":"https://github.com/droplinked/droplink-packages#readme","bugs":{"url":"https://github.com/droplinked/droplink-packages/issues"},"dist":{"shasum":"3c2b922f942749f729b116753bd5c204cf317e8a","tarball":"https://registry.npmjs.org/@droplinked_inc/web3-kit/-/web3-kit-1.0.0.tgz","fileCount":37,"integrity":"sha512-o5+iM1ruvfCeSWCqvkW00ZVADgb/6PxDH8vHsfDPScE2yHJYO7QiUpgbcn8Yw8LIsTNWZhMuBYur5Wlnwafu7Q==","signatures":[{"sig":"MEUCIHhrDZjGCvBCGCbcefwwkaCSWVl6SeJvmUXKb6vTfDCkAiEAvWTFfJ0ZOEmaih4JYuqwv+XbG/ykNbdflCFtI42ClXs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":120467},"main":"./dist/index.js","type":"module","_from":"file:droplinked_inc-web3-kit-1.0.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"lint":"eslint src --max-warnings=0","test":"jest","build":"tsc -p tsconfig.json","typecheck":"tsc --noEmit -p tsconfig.json","test:coverage":"jest --coverage"},"_npmUser":{"name":"droplinked_inc","email":"ali@droplinked.com"},"_resolved":"/tmp/8a3dbb9ffb9f220c0b7d144ee6320b62/droplinked_inc-web3-kit-1.0.0.tgz","_integrity":"sha512-o5+iM1ruvfCeSWCqvkW00ZVADgb/6PxDH8vHsfDPScE2yHJYO7QiUpgbcn8Yw8LIsTNWZhMuBYur5Wlnwafu7Q==","repository":{"url":"git+https://github.com/droplinked/droplink-packages.git","type":"git","directory":"packages/web3-kit"},"_npmVersion":"10.9.7","description":"Higher-level web3 building blocks (chain registry, known-token registry, display formatters, tx builders) — hardened rebuild of the original droplinked-web3-kit@1.0.13.","directories":{},"sideEffects":false,"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.23.8","viem":"^2.21.0"},"publishConfig":{"access":"public","provenance":false},"_hasShrinkwrap":false,"devDependencies":{"fast-check":"^3.22.0","typescript":"^5.6.0","@types/jest":"^29.5.12","@types/node":"^22.5.0","@droplinked_inc/wallet-connection":"0.3.0"},"peerDependencies":{"@droplinked_inc/wallet-connection":"0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/web3-kit_1.0.0_1779173508750_0.3450541580440978","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@droplinked_inc/web3-kit","version":"2.0.0","license":"MIT","_id":"@droplinked_inc/web3-kit@2.0.0","maintainers":[{"name":"droplinked_inc","email":"ali@droplinked.com"}],"homepage":"https://github.com/droplinked/droplink-packages#readme","bugs":{"url":"https://github.com/droplinked/droplink-packages/issues"},"dist":{"shasum":"f76c9a625ae277a615900875363f6d7409d3b2dd","tarball":"https://registry.npmjs.org/@droplinked_inc/web3-kit/-/web3-kit-2.0.0.tgz","fileCount":37,"integrity":"sha512-meVN4IlByocYSA3Y/g4HmY1q7gmE1D9glqHRplBxKBIqc6yDSWGCM/0vkcaoOU46bEn1UF1tpKdIF0PeJb+w1w==","signatures":[{"sig":"MEYCIQDqSbcG2o1hCRWtKp8NpWLo+lXzk4ekVfwy5QGFGARQJQIhAICTaidg5JhT1MWuX5nHYvW2s6vrHevGQiiKXHlDleyZ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":120574},"main":"./dist/index.js","type":"module","_from":"file:droplinked_inc-web3-kit-2.0.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"lint":"eslint src --max-warnings=0","test":"jest","build":"tsc -p tsconfig.json","typecheck":"tsc --noEmit -p tsconfig.json","test:coverage":"jest --coverage"},"_npmUser":{"name":"droplinked_inc","email":"ali@droplinked.com"},"_resolved":"/tmp/bde15b94eccd82a43cd03f7effce30be/droplinked_inc-web3-kit-2.0.0.tgz","_integrity":"sha512-meVN4IlByocYSA3Y/g4HmY1q7gmE1D9glqHRplBxKBIqc6yDSWGCM/0vkcaoOU46bEn1UF1tpKdIF0PeJb+w1w==","repository":{"url":"git+https://github.com/droplinked/droplink-packages.git","type":"git","directory":"packages/web3-kit"},"_npmVersion":"10.9.7","description":"Higher-level web3 building blocks (chain registry, known-token registry, display formatters, tx builders) — hardened rebuild of the original droplinked-web3-kit@1.0.13.","directories":{},"sideEffects":false,"_nodeVersion":"22.22.2","dependencies":{"zod":"^3.23.8","viem":"^2.21.0"},"publishConfig":{"access":"public","provenance":false},"_hasShrinkwrap":false,"devDependencies":{"fast-check":"^3.22.0","typescript":"^5.6.0","@types/jest":"^29.5.12","@types/node":"^22.5.0","@droplinked_inc/wallet-connection":"0.4.0"},"peerDependencies":{"@droplinked_inc/wallet-connection":"0.4.0"},"_npmOperationalInternal":{"tmp":"tmp/web3-kit_2.0.0_1779330277297_0.44216346436893494","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@droplinked_inc/web3-kit","version":"2.0.1","description":"Higher-level web3 building blocks (chain registry, known-token registry, display formatters, tx builders) — hardened rebuild of the original droplinked-web3-kit@1.0.13.","license":"MIT","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"sideEffects":false,"dependencies":{"viem":"^2.21.0","zod":"^3.23.8"},"peerDependencies":{"@droplinked_inc/wallet-connection":"0.4.1"},"devDependencies":{"@types/jest":"^29.5.12","@types/node":"^22.5.0","fast-check":"^3.22.0","typescript":"^5.6.0","@droplinked_inc/wallet-connection":"0.4.1"},"publishConfig":{"provenance":false,"access":"public"},"repository":{"type":"git","url":"git+https://github.com/droplinked/droplink-packages.git","directory":"packages/web3-kit"},"engines":{"node":">=22.0.0"},"scripts":{"build":"tsc -p tsconfig.json","test":"jest","test:coverage":"jest --coverage","lint":"eslint src --max-warnings=0","typecheck":"tsc --noEmit -p tsconfig.json"},"_id":"@droplinked_inc/web3-kit@2.0.1","bugs":{"url":"https://github.com/droplinked/droplink-packages/issues"},"homepage":"https://github.com/droplinked/droplink-packages#readme","_integrity":"sha512-31KGaiA5HTB9uxvuPUj5eOKzXMS0XZe0QoJiGm3FboL5ZeVnpjfYV/xh2kj5xQkf5/zdikxRaZgEWKcxeKIiUQ==","_resolved":"/tmp/175ac118d9cf0269e355ec79609eccbf/droplinked_inc-web3-kit-2.0.1.tgz","_from":"file:droplinked_inc-web3-kit-2.0.1.tgz","_nodeVersion":"22.23.1","_npmVersion":"11.19.0","dist":{"integrity":"sha512-31KGaiA5HTB9uxvuPUj5eOKzXMS0XZe0QoJiGm3FboL5ZeVnpjfYV/xh2kj5xQkf5/zdikxRaZgEWKcxeKIiUQ==","shasum":"068d2ca864797db0e9b8f4ffd04193e88b290777","tarball":"https://registry.npmjs.org/@droplinked_inc/web3-kit/-/web3-kit-2.0.1.tgz","fileCount":37,"unpackedSize":121380,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDU3SHNVMrXa76sZ7Wiz4sg0++tyATUmEVvEhFYtwfwLAiEA/kP0bxYDvO4nkgoC1tyuiBaPx7a5gHOEDiPdmUBrtQk="}]},"_npmUser":{"name":"droplinked_inc","email":"ali@droplinked.com"},"directories":{},"maintainers":[{"name":"droplinked_inc","email":"ali@droplinked.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/web3-kit_2.0.1_1786016229572_0.43043911299032955"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-19T05:25:42.866Z","modified":"2026-08-06T11:37:09.881Z","0.1.0":"2026-05-19T05:25:43.131Z","1.0.0":"2026-05-19T06:51:48.899Z","2.0.0":"2026-05-21T02:24:37.469Z","2.0.1":"2026-08-06T11:37:09.746Z"},"bugs":{"url":"https://github.com/droplinked/droplink-packages/issues"},"license":"MIT","homepage":"https://github.com/droplinked/droplink-packages#readme","repository":{"type":"git","url":"git+https://github.com/droplinked/droplink-packages.git","directory":"packages/web3-kit"},"description":"Higher-level web3 building blocks (chain registry, known-token registry, display formatters, tx builders) — hardened rebuild of the original droplinked-web3-kit@1.0.13.","maintainers":[{"name":"droplinked_inc","email":"ali@droplinked.com"}],"readme":"# @droplinked_inc/web3-kit\n\n> Replaces `droplinked-web3-kit`. See [MIGRATION.md](../../docs/MIGRATION.md) for the swap path.\n\nHigher-level web3 building blocks for the Droplinked frontend stack: a\nfrozen chain registry, a hard-coded known-token registry, decimal-safe\ndisplay formatters, and viem-backed transaction builders.\n\nThis is a hardened rebuild of the original `droplinked-web3-kit@1.0.13`.\nSee [`THREAT_MODEL.md`](./THREAT_MODEL.md) for the security deltas.\n\n## Status\n\nInitial rebuild. Stable surface; coverage 96.81% statements / 96.87% branches.\n\n## Install\n\n```bash\npnpm add @droplinked_inc/web3-kit @droplinked_inc/wallet-connection\n```\n\n`@droplinked_inc/wallet-connection` is a **peer dependency** — this kit\ndoes not reimplement EIP-1193 provider discovery, EIP-712 login signing,\nsession storage, or wallet-protocol logic. Those primitives live in\n`@droplinked_inc/wallet-connection`.\n\n## Modules\n\n| Module        | Surface                                                                       |\n| ------------- | ----------------------------------------------------------------------------- |\n| `chains`      | `chains`, `getChainByName`, `getChainDetails`, `isRpcUrlAllowed`, `getTransactionLink` |\n| `tokens`      | `TOKEN_REGISTRY`, `getTokenInfo`, `hasToken`, `listTokens`, `assertCanonicalTokenAddress` |\n| `format`      | `formatAmount`, `parseAmount`, `formatEther`, `parseEther`, `shortenAddress`, `escapeTokenDisplay`, `formatBalance` |\n| `tx-builder`  | `buildErc20Transfer`, `buildErc20Approve`, `buildNativeTransfer`, `buildEip712Domain` |\n| `types`       | `Chains`, `Network`, `Groups`, `PaymentTokens`, zod schemas                    |\n| `errors`      | typed exception hierarchy mirroring v1.0.13                                    |\n\n## Quick examples\n\n### Look up a chain and a token\n\n```ts\nimport { Chains, Network, getChainDetails, getTokenInfo } from '@droplinked_inc/web3-kit';\n\nconst polygon = getChainDetails(Chains.POLYGON, Network.MAINNET);\n// polygon.chainIdNumber === 137\n\nconst usdc = getTokenInfo(Chains.POLYGON, Network.MAINNET, 'USDC');\n// usdc.address === '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359'\n```\n\n### Reject a spoofed token address\n\n```ts\nimport { assertCanonicalTokenAddress, TokenAddressMismatchError } from '@droplinked_inc/web3-kit';\n\ntry {\n  assertCanonicalTokenAddress({\n    chain: Chains.POLYGON,\n    network: Network.MAINNET,\n    symbol: 'USDC',\n    claimedAddress: backendResponse.usdcAddress, // attacker-controlled\n  });\n} catch (err) {\n  if (err instanceof TokenAddressMismatchError) {\n    // refuse the checkout — your backend lied about what address USDC has\n  }\n}\n```\n\n### Build an ERC-20 transfer\n\n```ts\nimport { buildErc20Transfer, parseAmount } from '@droplinked_inc/web3-kit';\n\nconst call = buildErc20Transfer({\n  chain: Chains.POLYGON,\n  network: Network.MAINNET,\n  tokenSymbol: 'USDC',\n  to: recipient,\n  amount: parseAmount('1.5', 6),\n});\n// call.to       === USDC contract on Polygon\n// call.data     === 0x...a9059cbb… (transfer(address,uint256))\n// call.value    === 0n\n// call.chainIdNumber === 137\n```\n\nThen hand `call` to a wallet connector from `@droplinked_inc/wallet-connection`\nto actually broadcast it.\n\n### Format balances safely\n\n```ts\nimport { formatBalance, escapeTokenDisplay } from '@droplinked_inc/web3-kit';\n\nformatBalance({ value: 1_999_999n, decimals: 6, displayDecimals: 2 });\n// \"1.99\"  — truncated, never rounded up. The user can't be shown more than they hold.\n\nescapeTokenDisplay(maliciousTokenName);\n// HTML-escaped, control-char-stripped, bidi-override-stripped, length-capped.\n```\n\n## Security model\n\nSee [`THREAT_MODEL.md`](./THREAT_MODEL.md). Highlights:\n\n- The chain registry and the known-token registry are **frozen at package\n  build time**. No remote fetches, no backend-driven addresses.\n- Caller-supplied token addresses for known symbols (USDC, USDT, DAI,\n  WETH, USDS) are **validated against the registry** — passing any other\n  address as e.g. \"USDC\" throws `TokenAddressMismatchError`.\n- All amounts are `bigint`. `parseAmount` rejects inputs with more\n  fractional digits than the token allows, preventing silent truncation\n  that could let a UI display \"1.234 USDC\" but submit \"1.23 USDC\".\n- `escapeTokenDisplay` strips ASCII control chars, Unicode bidi-override\n  chars, and HTML metachars before any on-chain string reaches a UI.\n- RPC URLs passed by callers are validated against the registry via\n  `isRpcUrlAllowed` (https-only, exact host+path match).\n- Transaction-hash inputs to `getTransactionLink` are regex-validated\n  to block `javascript:` open-redirect payloads.\n\n## License\n\nMIT — see [`LICENSE`](../../LICENSE).\n","readmeFilename":"README.md"}