Skip to content

Commit 0d2d9f8

Browse files
committed
chore: migrate defined -> codex
1 parent bc1f970 commit 0d2d9f8

File tree

22 files changed

+65
-67
lines changed

22 files changed

+65
-67
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ jobs:
2020
- run: bun run build
2121
- run: npm publish --access public
2222
env:
23-
NPM_TOKEN: ${{secrets.DEFINED_SDK_NPM_TOKEN}}
23+
NPM_TOKEN: ${{secrets.CODEX_SDK_NPM_TOKEN}}

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ It provides the public schema SDL for you to use. You can use graphql-codegen to
66

77
> [!NOTE]
88
> We've changed our name from Defined to Codex.
9-
>
9+
>
1010
> You will see references to our previous company name, Defined, while we make the switch to Codex.
1111
1212
## Installation
1313

1414
| packager | command |
1515
| ----------------------------- | ------------------------- |
16-
| [npm](https://www.npmjs.com/) | `npm add @definedfi/sdk` |
17-
| [yarn](https://yarnpkg.com/) | `yarn add @definedfi/sdk` |
18-
| [bun](https://bun.sh/) | `bun add @definedfi/sdk` |
16+
| [npm](https://www.npmjs.com/) | `npm add @codex-data/sdk` |
17+
| [yarn](https://yarnpkg.com/) | `yarn add @codex-data/sdk` |
18+
| [bun](https://bun.sh/) | `bun add @codex-data/sdk` |
1919

2020
## Usage
2121

@@ -24,9 +24,9 @@ Follow one of the examples in the [examples](/examples) directory, or simply run
2424
Fetch a token.
2525

2626
```typescript
27-
import { Defined } from "@definedfi/sdk";
27+
import { Codex } from "@codex-data/sdk";
2828

29-
const sdk = new Defined(MY_API_KEY);
29+
const sdk = new Codex(MY_API_KEY);
3030

3131
sdk.queries
3232
.token({
@@ -42,9 +42,9 @@ Use your own GraphQL selections
4242

4343
```typescript
4444
import { Network } from "../../src/resources/graphql";
45-
import { Defined } from "@definedfi/sdk/dist/sdk";
45+
import { Codex } from "@codex-data/sdk/dist/sdk";
4646

47-
const sdk = new Defined(process.env.DEFINED_API_KEY || "");
47+
const sdk = new Codex(process.env.CODEX_API_KEY || "");
4848

4949
sdk
5050
.send<{ getNetworks: Network[] }>(
@@ -62,7 +62,7 @@ sdk
6262

6363
## Running the examples
6464

65-
You'll need to have [`curl`](https://curl.se/) installed in order to build this locally, as it fetches the schema from the Defined API.
65+
You'll need to have [`curl`](https://curl.se/) installed in order to build this locally, as it fetches the schema from the Codex API.
6666

6767
You need to provide an API key in order for the examples to work. We have [bun](https://bun.sh) in use for development here.
6868

@@ -77,7 +77,7 @@ This performs a simple inline graphql request, and uses a user-provided query an
7777

7878
- `cd examples/simple`
7979
- `bun i`
80-
- `DEFINED_API_KEY=xyz bun run index.ts`
80+
- `CODEX_API_KEY=xyz bun run index.ts`
8181

8282
You can define your own GraphQL queries and use those with codegen (see next section). The pre-defined queries we provide in the
8383
examples do not include all of the fields for every query.
@@ -89,15 +89,15 @@ This shows how to use graphql-codegen to generate query types and get a fully ty
8989
- `cd examples/codegen`
9090
- `bun i`
9191
- `bun run codegen`
92-
- `DEFINED_API_KEY=xyz bun run src/index.ts`
92+
- `CODEX_API_KEY=xyz bun run src/index.ts`
9393

9494
### Next
9595

9696
This shows how you could use it in a NextJS project.
9797

9898
- `cd examples/next`
9999
- `bun i`
100-
- `NEXT_PUBLIC_DEFINED_API_KEY=xyz bun run dev`
100+
- `NEXT_PUBLIC_CODEX_API_KEY=xyz bun run dev`
101101

102102
## Contributing
103103

examples/codegen/codegen.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
import type { CodegenConfig } from '@graphql-codegen/cli';
1+
import type { CodegenConfig } from "@graphql-codegen/cli";
22

33
const config: CodegenConfig = {
44
overwrite: true,
5-
schema: "node_modules/@definedfi/sdk/src/resources/schema.graphql",
5+
schema: "node_modules/@codex-data/sdk/src/resources/schema.graphql",
66
documents: "src/**/*.ts",
77
generates: {
88
"src/gql/": {
99
preset: "client",
10-
plugins: ["typescript-document-nodes"]
11-
}
12-
}
10+
plugins: ["typescript-document-nodes"],
11+
},
12+
},
1313
};
1414

1515
export default config;

examples/codegen/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"license": "ISC",
1111
"description": "",
1212
"dependencies": {
13-
"@definedfi/sdk": "../../",
13+
"@codex-data/sdk": "../../",
1414
"@graphql-codegen/typescript-document-nodes": "^4.0.1",
1515
"graphql": "^16.8.0",
1616
"typescript": "^5.2.2"

examples/codegen/src/index.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Defined } from '../../../src/sdk';
2-
import { graphql } from './gql/gql';
3-
import { NetworksQuery, NetworksQueryVariables } from './gql/graphql';
1+
import { Codex } from "../../../src/sdk";
2+
import { graphql } from "./gql/gql";
3+
import { NetworksQuery, NetworksQueryVariables } from "./gql/graphql";
44

55
const doc = graphql(`
66
query Networks {
@@ -11,10 +11,8 @@ const doc = graphql(`
1111
}
1212
`);
1313

14-
const sdk = new Defined(process.env.DEFINED_API_KEY || "");
15-
16-
sdk.query<NetworksQuery, NetworksQueryVariables>(doc).then(res => {
17-
console.log("Fetched res", res)
18-
})
19-
14+
const sdk = new Codex(process.env.CODEX_API_KEY || "");
2015

16+
sdk.query<NetworksQuery, NetworksQueryVariables>(doc).then((res) => {
17+
console.log("Fetched res", res);
18+
});

examples/next/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next
55
First, run the development server:
66

77
```bash
8-
NEXT_PUBLIC_DEFINED_API_KEY=xyz npm run dev
8+
NEXT_PUBLIC_CODEX_API_KEY=xyz npm run dev
99
# or
10-
NEXT_PUBLIC_DEFINED_API_KEY=xyz yarn run dev
10+
NEXT_PUBLIC_CODEX_API_KEY=xyz yarn run dev
1111
# or
12-
NEXT_PUBLIC_DEFINED_API_KEY=xyz pnpm dev
12+
NEXT_PUBLIC_CODEX_API_KEY=xyz pnpm dev
1313
```
1414

1515
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

examples/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
"react": "18.2.0",
1717
"react-dom": "18.2.0",
1818
"typescript": "5.2.2",
19-
"@definedfi/sdk": "../../"
19+
"@codex-data/sdk": "../../"
2020
}
2121
}

examples/next/src/app/GetNetworks.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { Defined } from "@definedfi/sdk/dist/sdk";
2-
import { Network } from "@definedfi/sdk/src/resources/graphql";
1+
import { Codex } from "@codex-data/sdk/dist/sdk";
2+
import { Network } from "@codex-data/sdk/src/resources/graphql";
33

44
async function getData() {
5-
const sdk = new Defined(process.env.NEXT_PUBLIC_DEFINED_API_KEY || "");
5+
const sdk = new Codex(process.env.NEXT_PUBLIC_CODEX_API_KEY || "");
66
const res = await sdk.send<{ getNetworks: Network[] }>(
77
`query { getNetworks { id, name } }`,
88
);

examples/simple/bun.lockb

-265 KB
Binary file not shown.

examples/simple/filterTest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Defined } from '@definedfi/sdk'
1+
import { Codex } from '@codex-data/sdk'
22

3-
const sdk = new Defined(process.env.DEFINED_API_KEY || "")
3+
const sdk = new Codex(process.env.CODEX_API_KEY || "")
44

55
sdk.queries.filterTokens({
66
filters: {

0 commit comments

Comments
 (0)