
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@ensdomains/ccip-read-router
Advanced tools
A lightweight package for routing CCIP-Read requests, using [itty-router](https://itty.dev/itty-router/).
A lightweight package for routing CCIP-Read requests, using itty-router.
Install with:
bun add @ensdomains/ccip-read-router itty-router viem
import { CcipReadRouter } from "@ensdomains/ccip-read-router";
// 1. Create a router instance
const router = CcipReadRouter();
// 2. Add a route
router.add({
// Function signature for the route
type: "function bar(uint256) pure returns (uint256)",
// Handler, with args based on function signature
handle: async ([x]) => {
// Return type based on function signature, or arbitrary hex (0x...)
return [x * 2n];
},
});
// 3. Consume the router...
Most customisation is inherited from itty-router.
import { CcipReadRouter } from "@ensdomains/ccip-read-router";
const router = CcipReadRouter({ base: "/ccip-read" });
From itty-router docs:
import { CcipReadRouter } from "@ensdomains/ccip-read-router";
import { cors } from "itty-router";
// get preflight and corsify pair
const { preflight, corsify } = cors();
const router = CcipReadRouter({
before: [preflight], // add preflight upstream
finally: [corsify], // and corsify downstream
});
Just export the router from your worker file.
import { CcipReadRouter } from "@ensdomains/ccip-read-router";
const router = CcipReadRouter();
router.add({
type: "function bar(uint256) pure returns (uint256)",
handle: async ([x]) => {
return [x * 2n];
},
});
export default { ...router };
Initialise the router with the port you want to use, and export.
import { CcipReadRouter } from "@ensdomains/ccip-read-router";
const router = CcipReadRouter({ port: 3001 });
router.add({
type: "function bar(uint256) pure returns (uint256)",
handle: async ([x]) => {
return [x * 2n];
},
});
export default router;
Use the @whatwg-node/server adapter.
import { CcipReadRouter } from "@ensdomains/ccip-read-router";
import { createServerAdapter } from "@whatwg-node/server";
import { createServer } from "http";
const router = CcipReadRouter();
router.add({
type: "function bar(uint256) pure returns (uint256)",
handle: async ([x]) => {
return [x * 2n];
},
});
// create a @whatwg-node/server
const ccipReadServer = createServerAdapter(router.fetch);
// then pass that to Node
const httpServer = createServer(ccipReadServer);
httpServer.listen(3001);
See the runtime guides section of the itty-router docs.
FAQs
A lightweight package for routing CCIP-Read requests, using [itty-router](https://itty.dev/itty-router/).
The npm package @ensdomains/ccip-read-router receives a total of 3 weekly downloads. As such, @ensdomains/ccip-read-router popularity was classified as not popular.
We found that @ensdomains/ccip-read-router demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.