Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@codex-data/sdk
Advanced tools
The Codex SDK for JavaScript/Typescript. It provides generated types and convenient ways to access the graphql api.
This package exists to help you develop on top of the Codex API (https://docs.codex.io).
It provides the public schema SDL for you to use. You can use graphql-codegen to generate types and queries for example.
[!NOTE] We've changed our name from Defined to Codex.
You will see references to our previous company name, Defined, while we make the switch to Codex.
packager | command |
---|---|
npm | npm add @codex-data/sdk |
yarn | yarn add @codex-data/sdk |
bun | bun add @codex-data/sdk |
Follow one of the examples in the examples directory, or simply run.
Fetch a token.
import { Codex } from "@codex-data/sdk";
const sdk = new Codex(MY_API_KEY);
sdk.queries
.token({
input: {
address: "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
networkId: 56,
},
})
.then(console.log);
Use your own GraphQL selections
import { Network } from "../../src/resources/graphql";
import { Codex } from "@codex-data/sdk/dist/sdk";
const sdk = new Codex(process.env.CODEX_API_KEY || "");
sdk
.send<{ getNetworks: Network[] }>(
`
query GetNetworks {
getNetworks { id name }
}
`,
{}
)
.then((res) => {
console.log("Networks: ", res.getNetworks);
});
You'll need to have curl
installed in order to build this locally, as it fetches the schema from the Codex API.
You need to provide an API key in order for the examples to work. We have bun in use for development here.
After installing bun, from the project root.
bun i
bun run build
This performs a simple inline graphql request, and uses a user-provided query and selection set.
cd examples/simple
bun i
CODEX_API_KEY=xyz bun run index.ts
You can define your own GraphQL queries and use those with codegen (see next section). The pre-defined queries we provide in the examples do not include all of the fields for every query.
This shows how to use graphql-codegen to generate query types and get a fully typed end-to-end experience.
cd examples/codegen
bun i
bun run codegen
CODEX_API_KEY=xyz bun run src/index.ts
This shows how you could use it in a NextJS project.
cd examples/next
bun i
NEXT_PUBLIC_CODEX_API_KEY=xyz bun run dev
Prs open!
FAQs
The Codex SDK for JavaScript/Typescript. It provides generated types and convenient ways to access the graphql api.
The npm package @codex-data/sdk receives a total of 1,329 weekly downloads. As such, @codex-data/sdk popularity was classified as popular.
We found that @codex-data/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.