From 357e13df18f1b0cf92bd7b79a76bba90751bcc58 Mon Sep 17 00:00:00 2001 From: Kyle Poole Date: Mon, 9 Nov 2026 15:38:03 -0700 Subject: [PATCH 1/3] feat: support BSC processed edge subscriptions --- README.md | 6 +++--- src/edge.bundle.test.ts | 5 +++-- src/edge.ts | 1 + src/sdk/edge.test.ts | 36 ++++++++++++++++++++++++++++-------- src/sdk/edge.ts | 7 +++++-- src/sdk/edgeSubscription.ts | 7 +++++-- 6 files changed, 45 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 8e314b1..9c6efc4 100644 --- a/README.md +++ b/README.md @@ -307,7 +307,7 @@ const unsubscribe = sdk.subscriptions.onEventsCreated( ## Edge Subscriptions -Pass `{ useEdge: true }` as the third argument to a generated subscription method (or the fourth argument to `sdk.subscribe`) to use a regional edge node. Solana (`1399811149`) routes to `wss://fra.edge.codex.io/graphql`; Robinhood Chain (`4663`) routes to `wss://iad.edge.codex.io/graphql`. Connections are created on demand and reused per endpoint. +Pass `{ useEdge: true }` as the third argument to a generated subscription method (or the fourth argument to `sdk.subscribe`) to use a regional edge node. Solana (`1399811149`) routes to `wss://fra.edge.codex.io/graphql`; Robinhood Chain (`4663`) and BSC (`56`) route to `wss://iad.edge.codex.io/graphql` in `us-east-1`. Connections are created on demand and reused per endpoint. ```typescript import { Codex, EventCommitmentLevel } from "@codex-data/sdk"; @@ -316,7 +316,7 @@ const sdk = new Codex(process.env.CODEX_API_KEY!); const unsubscribe = sdk.subscriptions.onTokenEventsCreated( { - input: { tokenAddress: "0x...", networkId: 4663 }, + input: { tokenAddress: "0x...", networkId: 56 }, commitmentLevel: [EventCommitmentLevel.Processed], }, { @@ -330,7 +330,7 @@ const unsubscribe = sdk.subscriptions.onTokenEventsCreated( Edge supports `onEventsCreated`, `onTokenEventsCreated`, `onBarsUpdated`, and `onTokenBarsUpdated`. The commitment levels must include `Processed`, and `onBarsUpdated` requires an explicit `quoteToken`. Each subscription must target one supported chain. Subscriptions without `useEdge` use the main endpoint. -The lightweight `withEdge` helper from `@codex-data/sdk/edge` uses the same routing. For a standalone Robinhood connection, pass `url: ROBINHOOD_EDGE_URL` to `createEdgeClient`, importing both from `@codex-data/sdk/edge`. The SDK's `apiEdgeUrl` and the helper's `edgeUrl` override routing for all chains. +The lightweight `withEdge` helper from `@codex-data/sdk/edge` uses the same routing. For a standalone Robinhood or BSC connection, pass `url: ROBINHOOD_EDGE_URL` or `url: BSC_EDGE_URL` to `createEdgeClient`, importing them from `@codex-data/sdk/edge`. The SDK's `apiEdgeUrl` and the helper's `edgeUrl` override routing for all chains. ## Custom Queries: Request Only the Fields You Need diff --git a/src/edge.bundle.test.ts b/src/edge.bundle.test.ts index 5d2cbe0..0c47030 100644 --- a/src/edge.bundle.test.ts +++ b/src/edge.bundle.test.ts @@ -36,7 +36,7 @@ beforeAll(async () => { } const result = await build({ stdin: { - contents: `export { createClient, createEdgeClient, DEFAULT_EDGE_URL, ROBINHOOD_EDGE_URL, withEdge } from "@codex-data/sdk/edge";`, + contents: `export { createClient, createEdgeClient, DEFAULT_EDGE_URL, ROBINHOOD_EDGE_URL, BSC_EDGE_URL, withEdge } from "@codex-data/sdk/edge";`, resolveDir: fixture, sourcefile: "consumer.js", }, @@ -96,7 +96,8 @@ it.each(["import", "require"])( assert.equal(typeof sdk.createEdgeClient, "function"); assert.equal(typeof sdk.withEdge, "function"); assert.equal(sdk.DEFAULT_EDGE_URL, "wss://fra.edge.codex.io/graphql"); - assert.equal(sdk.ROBINHOOD_EDGE_URL, "wss://iad.edge.codex.io/graphql");`, + assert.equal(sdk.ROBINHOOD_EDGE_URL, "wss://iad.edge.codex.io/graphql"); + assert.equal(sdk.BSC_EDGE_URL, "wss://iad.edge.codex.io/graphql");`, ], { cwd: fixture, stdio: "pipe" }, ); diff --git a/src/edge.ts b/src/edge.ts index 1f816a6..c8e1f71 100644 --- a/src/edge.ts +++ b/src/edge.ts @@ -1,4 +1,5 @@ export { + BSC_EDGE_URL, createClient, createEdgeClient, DEFAULT_EDGE_URL, diff --git a/src/sdk/edge.test.ts b/src/sdk/edge.test.ts index de44406..756da60 100644 --- a/src/sdk/edge.test.ts +++ b/src/sdk/edge.test.ts @@ -1,6 +1,7 @@ import { type ClientOptions, createClient } from "graphql-ws"; import { + BSC_EDGE_URL, createEdgeClient, DEFAULT_EDGE_URL, ROBINHOOD_EDGE_URL, @@ -35,6 +36,10 @@ const robinhoodVariables = { ...variables, input: { ...variables.input, networkId: 4663 }, }; +const bscVariables = { + ...variables, + input: { ...variables.input, networkId: 56 }, +}; beforeEach(() => { transports.length = 0; @@ -63,7 +68,7 @@ it("creates a standalone edge transport without creating a main transport", () = }); it.each(["sdk", "withEdge"])( - "%s routes each chain to its own reusable edge transport and disposes all transports", + "%s routes each chain to its regional endpoint, reuses transports, and disposes all transports", async (api) => { const sdk = api === "sdk" ? new Codex("customer") : undefined; const client = @@ -79,8 +84,11 @@ it.each(["sdk", "withEdge"])( useEdge, }); subscribe(robinhoodVariables, false); + subscribe(bscVariables, false); subscribe(variables); subscribe(robinhoodVariables); + subscribe(bscVariables); + subscribe(bscVariables); subscribe(variables); subscribe(robinhoodVariables); expect(transports.map(({ options }) => options.url)).toEqual([ @@ -90,11 +98,16 @@ it.each(["sdk", "withEdge"])( ]); expect( transports.map(({ subscribe }) => subscribe.mock.calls.length), - ).toEqual([1, 2, 2]); + ).toEqual([2, 2, 4]); expect(transports[2].subscribe).toHaveBeenCalledWith( { query: events, variables: robinhoodVariables }, sink, ); + expect(transports[2].options.url).toBe(BSC_EDGE_URL); + expect(transports[2].subscribe).toHaveBeenCalledWith( + { query: events, variables: bscVariables }, + sink, + ); for (const { options } of transports) { expect(options.connectionParams).toEqual({ Authorization: "customer" }); } @@ -113,7 +126,7 @@ it.each(["sdk", "withEdge"])( ); it.each(["sdk", "withEdge"])( - "%s honors endpoint overrides for both chains", + "%s honors endpoint overrides for all supported chains", async (api) => { const url = "wss://edge.staging.example/graphql"; const sdk = @@ -121,7 +134,7 @@ it.each(["sdk", "withEdge"])( const client = sdk ?? createClientWithEdge({ url: "wss://main.example/graphql", edgeUrl: url }); - for (const values of [variables, robinhoodVariables]) { + for (const values of [variables, robinhoodVariables, bscVariables]) { if (client instanceof Codex) client.subscribe(events, values, sink, { useEdge: true }); else @@ -131,15 +144,15 @@ it.each(["sdk", "withEdge"])( } expect(transports).toHaveLength(2); expect(transports[1].options.url).toBe(url); - expect(transports[1].subscribe).toHaveBeenCalledTimes(2); + expect(transports[1].subscribe).toHaveBeenCalledTimes(3); await client.dispose(); }, ); -it("routes generated Robinhood subscriptions and recreates both edge clients after config updates", async () => { +it("routes generated Robinhood and BSC subscriptions and recreates both edge clients after config updates", async () => { const sdk = new Codex("customer"); const subscribe = () => { - for (const { input } of [variables, robinhoodVariables]) { + for (const { input } of [variables, robinhoodVariables, bscVariables]) { sdk.subscriptions.onTokenEventsCreated( { input, commitmentLevel: [EventCommitmentLevel.Processed] }, sink, @@ -152,6 +165,9 @@ it("routes generated Robinhood subscriptions and recreates both edge clients aft expect(transports[2].subscribe.mock.calls[0][0].variables.input).toEqual( robinhoodVariables.input, ); + expect(transports[2].subscribe.mock.calls[1][0].variables.input).toEqual( + bscVariables.input, + ); sdk.updateConfig({ wsHeaders: { Authorization: "refreshed" } }); expect( transports @@ -276,6 +292,7 @@ it.each([ for (const [networkId, url] of [ [1399811149, DEFAULT_EDGE_URL], [4663, ROBINHOOD_EDGE_URL], + [56, BSC_EDGE_URL], ]) { const client = createClientWithEdge({ url: "wss://main.example/graphql", @@ -337,6 +354,9 @@ it.each([ `subscription { onEventsCreated(id: "pair:46630", commitmentLevel: [Processed]) { events { transactionHash } } }`, `subscription { onEventsCreated(id: "pair:4663", commitmentLevel: [Confirmed]) { events { transactionHash } } }`, `subscription { onEventsCreated(id: "pair:4663", commitmentLevel: [Processed, Finalized]) { events { transactionHash } } }`, + `subscription { onEventsCreated(id: "pair:56", networkId: 4663, commitmentLevel: [Processed]) { events { transactionHash } } }`, + `subscription { onEventsCreated(id: "pair:56", commitmentLevel: [Confirmed]) { events { transactionHash } } }`, + `subscription { onEventsCreated(id: "pair:560", commitmentLevel: [Processed]) { events { transactionHash } } }`, `subscription { onEventsCreated(commitmentLevel: [Processed]) { events { transactionHash } } }`, `subscription { onTokenBarsUpdated(tokenId: "token", commitmentLevel: [Processed]) { timestamp } }`, `subscription { a: onEventsCreated(networkId: 1399811149, commitmentLevel: [Processed]) { id } b: onEventsCreated(networkId: 1399811149, commitmentLevel: [Processed]) { id } }`, @@ -350,7 +370,7 @@ it.each([ expect(transports).toHaveLength(1); }); -it.each([1399811149, 4663])( +it.each([1399811149, 4663, 56])( "rejects implicit pair quote selection for network %s instead of letting edge relay it through Oregon", (networkId) => { const client = createClientWithEdge({ url: "wss://main.example/graphql" }); diff --git a/src/sdk/edge.ts b/src/sdk/edge.ts index 2421080..2798497 100644 --- a/src/sdk/edge.ts +++ b/src/sdk/edge.ts @@ -11,6 +11,7 @@ import { import { assertEdgeSubscription, + BSC_NETWORK_ID, ROBINHOOD_NETWORK_ID, } from "./edgeSubscription"; @@ -18,15 +19,17 @@ export { createClient }; export const DEFAULT_EDGE_URL = "wss://fra.edge.codex.io/graphql"; export const ROBINHOOD_EDGE_URL = "wss://iad.edge.codex.io/graphql"; +export const BSC_EDGE_URL = "wss://iad.edge.codex.io/graphql"; export function edgeUrlForNetwork(networkId: number): string { + if (networkId === BSC_NETWORK_ID) return BSC_EDGE_URL; return networkId === ROBINHOOD_NETWORK_ID ? ROBINHOOD_EDGE_URL : DEFAULT_EDGE_URL; } export interface SubscriptionOptions { - /** Experimental: use edge for supported Solana or Robinhood streams whose commitments include Processed. */ + /** Experimental: use edge for supported Solana, Robinhood, or BSC streams whose commitments include Processed. */ useEdge?: boolean; } @@ -45,7 +48,7 @@ export interface ClientWithEdge extends Client { } export interface EdgeClientOptions extends Omit { - /** Defaults to the Solana edge endpoint. Use ROBINHOOD_EDGE_URL for Robinhood. */ + /** Defaults to the Solana edge endpoint. Use ROBINHOOD_EDGE_URL or BSC_EDGE_URL for those networks. */ url?: ClientOptions["url"]; } diff --git a/src/sdk/edgeSubscription.ts b/src/sdk/edgeSubscription.ts index ef06000..abedd4e 100644 --- a/src/sdk/edgeSubscription.ts +++ b/src/sdk/edgeSubscription.ts @@ -3,6 +3,7 @@ import type { SubscribePayload } from "graphql-ws"; const SOLANA_NETWORK_ID = 1399811149; export const ROBINHOOD_NETWORK_ID = 4663; +export const BSC_NETWORK_ID = 56; const SUPPORTED_OPERATIONS = new Set([ "onEventsCreated", "onTokenEventsCreated", @@ -14,7 +15,7 @@ const SUPPORTED_OPERATIONS = new Set([ export function assertEdgeSubscription(payload: SubscribePayload): number { function fail(): never { throw new Error( - "useEdge requires a supported Solana or Robinhood subscription with commitmentLevel including Processed", + "useEdge requires a supported Solana, Robinhood, or BSC subscription with commitmentLevel including Processed", ); } const document = parse(payload.query); @@ -74,7 +75,9 @@ export function assertEdgeSubscription(payload: SubscribePayload): number { collect(args); const networkId = networks[0]; if ( - (networkId !== SOLANA_NETWORK_ID && networkId !== ROBINHOOD_NETWORK_ID) || + (networkId !== SOLANA_NETWORK_ID && + networkId !== ROBINHOOD_NETWORK_ID && + networkId !== BSC_NETWORK_ID) || networks.some((network) => network !== networkId) ) fail(); From 8e7702155ba6769c4d7eed7d7beb35727c717d51 Mon Sep 17 00:00:00 2001 From: Kyle Poole Date: Mon, 9 Nov 2026 15:46:50 -0700 Subject: [PATCH 2/3] chore: bump version to 2.6.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2005bc2..3977045 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codex-data/sdk", - "version": "2.5.24", + "version": "2.6.0", "engines": { "node": ">=17.5.0" }, From e627523c8dc749dd648e68496748d8da3b3ab5d9 Mon Sep 17 00:00:00 2001 From: Kyle Poole Date: Mon, 9 Nov 2026 15:59:39 -0700 Subject: [PATCH 3/3] refactor: use BNB naming for processed subscriptions --- README.md | 8 ++++---- src/edge.bundle.test.ts | 4 ++-- src/edge.ts | 2 +- src/sdk/edge.test.ts | 24 ++++++++++++------------ src/sdk/edge.ts | 10 +++++----- src/sdk/edgeSubscription.ts | 6 +++--- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 9c6efc4..d6b2174 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Codex SDK -The TypeScript SDK for the [Codex API](https://www.codex.io) — real-time blockchain data, token prices, OHLCV charts, wallet balances, and holder analytics for 60M+ tokens across 80+ networks including Ethereum, Solana, Base, Arbitrum, BSC, and Polygon. +The TypeScript SDK for the [Codex API](https://www.codex.io) — real-time blockchain data, token prices, OHLCV charts, wallet balances, and holder analytics for 60M+ tokens across 80+ networks including Ethereum, Solana, Base, Arbitrum, BNB, and Polygon. Codex is a GraphQL API used by teams like Coinbase, TradingView, Uniswap, Rainbow, FOMO, Farcaster, and hundreds of others. @@ -307,7 +307,7 @@ const unsubscribe = sdk.subscriptions.onEventsCreated( ## Edge Subscriptions -Pass `{ useEdge: true }` as the third argument to a generated subscription method (or the fourth argument to `sdk.subscribe`) to use a regional edge node. Solana (`1399811149`) routes to `wss://fra.edge.codex.io/graphql`; Robinhood Chain (`4663`) and BSC (`56`) route to `wss://iad.edge.codex.io/graphql` in `us-east-1`. Connections are created on demand and reused per endpoint. +Pass `{ useEdge: true }` as the third argument to a generated subscription method (or the fourth argument to `sdk.subscribe`) to use a regional edge node. Solana (`1399811149`) routes to `wss://fra.edge.codex.io/graphql`; Robinhood Chain (`4663`) and BNB (`56`) route to `wss://iad.edge.codex.io/graphql` in `us-east-1`. Connections are created on demand and reused per endpoint. ```typescript import { Codex, EventCommitmentLevel } from "@codex-data/sdk"; @@ -330,7 +330,7 @@ const unsubscribe = sdk.subscriptions.onTokenEventsCreated( Edge supports `onEventsCreated`, `onTokenEventsCreated`, `onBarsUpdated`, and `onTokenBarsUpdated`. The commitment levels must include `Processed`, and `onBarsUpdated` requires an explicit `quoteToken`. Each subscription must target one supported chain. Subscriptions without `useEdge` use the main endpoint. -The lightweight `withEdge` helper from `@codex-data/sdk/edge` uses the same routing. For a standalone Robinhood or BSC connection, pass `url: ROBINHOOD_EDGE_URL` or `url: BSC_EDGE_URL` to `createEdgeClient`, importing them from `@codex-data/sdk/edge`. The SDK's `apiEdgeUrl` and the helper's `edgeUrl` override routing for all chains. +The lightweight `withEdge` helper from `@codex-data/sdk/edge` uses the same routing. For a standalone Robinhood or BNB connection, pass `url: ROBINHOOD_EDGE_URL` or `url: BNB_EDGE_URL` to `createEdgeClient`, importing them from `@codex-data/sdk/edge`. The SDK's `apiEdgeUrl` and the helper's `edgeUrl` override routing for all chains. ## Custom Queries: Request Only the Fields You Need @@ -443,7 +443,7 @@ See the [codegen example](./examples/codegen) for a complete working project. | Network | ID | | --------- | ------------ | | Ethereum | `1` | -| BSC | `56` | +| BNB | `56` | | Polygon | `137` | | Arbitrum | `42161` | | Base | `8453` | diff --git a/src/edge.bundle.test.ts b/src/edge.bundle.test.ts index 0c47030..34c309f 100644 --- a/src/edge.bundle.test.ts +++ b/src/edge.bundle.test.ts @@ -36,7 +36,7 @@ beforeAll(async () => { } const result = await build({ stdin: { - contents: `export { createClient, createEdgeClient, DEFAULT_EDGE_URL, ROBINHOOD_EDGE_URL, BSC_EDGE_URL, withEdge } from "@codex-data/sdk/edge";`, + contents: `export { createClient, createEdgeClient, DEFAULT_EDGE_URL, ROBINHOOD_EDGE_URL, BNB_EDGE_URL, withEdge } from "@codex-data/sdk/edge";`, resolveDir: fixture, sourcefile: "consumer.js", }, @@ -97,7 +97,7 @@ it.each(["import", "require"])( assert.equal(typeof sdk.withEdge, "function"); assert.equal(sdk.DEFAULT_EDGE_URL, "wss://fra.edge.codex.io/graphql"); assert.equal(sdk.ROBINHOOD_EDGE_URL, "wss://iad.edge.codex.io/graphql"); - assert.equal(sdk.BSC_EDGE_URL, "wss://iad.edge.codex.io/graphql");`, + assert.equal(sdk.BNB_EDGE_URL, "wss://iad.edge.codex.io/graphql");`, ], { cwd: fixture, stdio: "pipe" }, ); diff --git a/src/edge.ts b/src/edge.ts index c8e1f71..d0acd42 100644 --- a/src/edge.ts +++ b/src/edge.ts @@ -1,5 +1,5 @@ export { - BSC_EDGE_URL, + BNB_EDGE_URL, createClient, createEdgeClient, DEFAULT_EDGE_URL, diff --git a/src/sdk/edge.test.ts b/src/sdk/edge.test.ts index 756da60..218e2e2 100644 --- a/src/sdk/edge.test.ts +++ b/src/sdk/edge.test.ts @@ -1,7 +1,7 @@ import { type ClientOptions, createClient } from "graphql-ws"; import { - BSC_EDGE_URL, + BNB_EDGE_URL, createEdgeClient, DEFAULT_EDGE_URL, ROBINHOOD_EDGE_URL, @@ -36,7 +36,7 @@ const robinhoodVariables = { ...variables, input: { ...variables.input, networkId: 4663 }, }; -const bscVariables = { +const bnbVariables = { ...variables, input: { ...variables.input, networkId: 56 }, }; @@ -84,11 +84,11 @@ it.each(["sdk", "withEdge"])( useEdge, }); subscribe(robinhoodVariables, false); - subscribe(bscVariables, false); + subscribe(bnbVariables, false); subscribe(variables); subscribe(robinhoodVariables); - subscribe(bscVariables); - subscribe(bscVariables); + subscribe(bnbVariables); + subscribe(bnbVariables); subscribe(variables); subscribe(robinhoodVariables); expect(transports.map(({ options }) => options.url)).toEqual([ @@ -103,9 +103,9 @@ it.each(["sdk", "withEdge"])( { query: events, variables: robinhoodVariables }, sink, ); - expect(transports[2].options.url).toBe(BSC_EDGE_URL); + expect(transports[2].options.url).toBe(BNB_EDGE_URL); expect(transports[2].subscribe).toHaveBeenCalledWith( - { query: events, variables: bscVariables }, + { query: events, variables: bnbVariables }, sink, ); for (const { options } of transports) { @@ -134,7 +134,7 @@ it.each(["sdk", "withEdge"])( const client = sdk ?? createClientWithEdge({ url: "wss://main.example/graphql", edgeUrl: url }); - for (const values of [variables, robinhoodVariables, bscVariables]) { + for (const values of [variables, robinhoodVariables, bnbVariables]) { if (client instanceof Codex) client.subscribe(events, values, sink, { useEdge: true }); else @@ -149,10 +149,10 @@ it.each(["sdk", "withEdge"])( }, ); -it("routes generated Robinhood and BSC subscriptions and recreates both edge clients after config updates", async () => { +it("routes generated Robinhood and BNB subscriptions and recreates both edge clients after config updates", async () => { const sdk = new Codex("customer"); const subscribe = () => { - for (const { input } of [variables, robinhoodVariables, bscVariables]) { + for (const { input } of [variables, robinhoodVariables, bnbVariables]) { sdk.subscriptions.onTokenEventsCreated( { input, commitmentLevel: [EventCommitmentLevel.Processed] }, sink, @@ -166,7 +166,7 @@ it("routes generated Robinhood and BSC subscriptions and recreates both edge cli robinhoodVariables.input, ); expect(transports[2].subscribe.mock.calls[1][0].variables.input).toEqual( - bscVariables.input, + bnbVariables.input, ); sdk.updateConfig({ wsHeaders: { Authorization: "refreshed" } }); expect( @@ -292,7 +292,7 @@ it.each([ for (const [networkId, url] of [ [1399811149, DEFAULT_EDGE_URL], [4663, ROBINHOOD_EDGE_URL], - [56, BSC_EDGE_URL], + [56, BNB_EDGE_URL], ]) { const client = createClientWithEdge({ url: "wss://main.example/graphql", diff --git a/src/sdk/edge.ts b/src/sdk/edge.ts index 2798497..37f781c 100644 --- a/src/sdk/edge.ts +++ b/src/sdk/edge.ts @@ -11,7 +11,7 @@ import { import { assertEdgeSubscription, - BSC_NETWORK_ID, + BNB_NETWORK_ID, ROBINHOOD_NETWORK_ID, } from "./edgeSubscription"; @@ -19,17 +19,17 @@ export { createClient }; export const DEFAULT_EDGE_URL = "wss://fra.edge.codex.io/graphql"; export const ROBINHOOD_EDGE_URL = "wss://iad.edge.codex.io/graphql"; -export const BSC_EDGE_URL = "wss://iad.edge.codex.io/graphql"; +export const BNB_EDGE_URL = "wss://iad.edge.codex.io/graphql"; export function edgeUrlForNetwork(networkId: number): string { - if (networkId === BSC_NETWORK_ID) return BSC_EDGE_URL; + if (networkId === BNB_NETWORK_ID) return BNB_EDGE_URL; return networkId === ROBINHOOD_NETWORK_ID ? ROBINHOOD_EDGE_URL : DEFAULT_EDGE_URL; } export interface SubscriptionOptions { - /** Experimental: use edge for supported Solana, Robinhood, or BSC streams whose commitments include Processed. */ + /** Experimental: use edge for supported Solana, Robinhood, or BNB streams whose commitments include Processed. */ useEdge?: boolean; } @@ -48,7 +48,7 @@ export interface ClientWithEdge extends Client { } export interface EdgeClientOptions extends Omit { - /** Defaults to the Solana edge endpoint. Use ROBINHOOD_EDGE_URL or BSC_EDGE_URL for those networks. */ + /** Defaults to the Solana edge endpoint. Use ROBINHOOD_EDGE_URL or BNB_EDGE_URL for those networks. */ url?: ClientOptions["url"]; } diff --git a/src/sdk/edgeSubscription.ts b/src/sdk/edgeSubscription.ts index abedd4e..1922848 100644 --- a/src/sdk/edgeSubscription.ts +++ b/src/sdk/edgeSubscription.ts @@ -3,7 +3,7 @@ import type { SubscribePayload } from "graphql-ws"; const SOLANA_NETWORK_ID = 1399811149; export const ROBINHOOD_NETWORK_ID = 4663; -export const BSC_NETWORK_ID = 56; +export const BNB_NETWORK_ID = 56; const SUPPORTED_OPERATIONS = new Set([ "onEventsCreated", "onTokenEventsCreated", @@ -15,7 +15,7 @@ const SUPPORTED_OPERATIONS = new Set([ export function assertEdgeSubscription(payload: SubscribePayload): number { function fail(): never { throw new Error( - "useEdge requires a supported Solana, Robinhood, or BSC subscription with commitmentLevel including Processed", + "useEdge requires a supported Solana, Robinhood, or BNB subscription with commitmentLevel including Processed", ); } const document = parse(payload.query); @@ -77,7 +77,7 @@ export function assertEdgeSubscription(payload: SubscribePayload): number { if ( (networkId !== SOLANA_NETWORK_ID && networkId !== ROBINHOOD_NETWORK_ID && - networkId !== BSC_NETWORK_ID) || + networkId !== BNB_NETWORK_ID) || networks.some((network) => network !== networkId) ) fail();