From 38f6ea77f11054716001be6dc92d6796b0d2f0e9 Mon Sep 17 00:00:00 2001 From: benzguo Date: Mon, 6 May 2024 22:49:58 -0400 Subject: [PATCH 1/3] ben-default-backend --- src/Substrate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Substrate.ts b/src/Substrate.ts index 8303a6d..7d14ef4 100644 --- a/src/Substrate.ts +++ b/src/Substrate.ts @@ -66,7 +66,7 @@ export class Substrate { this.baseUrl = baseUrl ?? "https://api.substrate.run"; this.apiVersion = apiVersion ?? OpenAPIjson["info"]["version"]; this.timeout = timeout ?? 300_000; - this.backend = backend ?? "v0"; + this.backend = backend ?? "v1"; this.additionalHeaders = additionalHeaders ?? {}; } From 136b41dc8249778a1b4fa41f813d68aaac9793a8 Mon Sep 17 00:00:00 2001 From: benzguo Date: Wed, 12 Jun 2024 00:48:53 -0400 Subject: [PATCH 2/3] remove backend param --- examples/jq.ts | 1 - examples/kitchen-sink.ts | 1 - examples/large-run.ts | 1 - src/Substrate.ts | 9 --------- 4 files changed, 12 deletions(-) diff --git a/examples/jq.ts b/examples/jq.ts index bc8f9dd..aa2a8f3 100755 --- a/examples/jq.ts +++ b/examples/jq.ts @@ -8,7 +8,6 @@ async function main() { const substrate = new Substrate({ apiKey: SUBSTRATE_API_KEY, baseUrl: "https://api.substrate.run", - backend: "v1", }); const a = new GenerateJSON({ diff --git a/examples/kitchen-sink.ts b/examples/kitchen-sink.ts index a33a40a..a16ea6b 100755 --- a/examples/kitchen-sink.ts +++ b/examples/kitchen-sink.ts @@ -594,7 +594,6 @@ async function main() { const substrate = new Substrate({ apiKey: SUBSTRATE_API_KEY, baseUrl: env.url.value, - backend: env.backend.value, }); const tag = `[${env.url.name}:${env.backend.value}]`; diff --git a/examples/large-run.ts b/examples/large-run.ts index 793818d..2fc0c0b 100755 --- a/examples/large-run.ts +++ b/examples/large-run.ts @@ -8,7 +8,6 @@ async function main() { const substrate = new Substrate({ apiKey: SUBSTRATE_API_KEY, baseUrl: "https://api-staging.substrate.run", - backend: "v1", }); let nodes = []; diff --git a/src/Substrate.ts b/src/Substrate.ts index 7d14ef4..4bf50b5 100644 --- a/src/Substrate.ts +++ b/src/Substrate.ts @@ -24,11 +24,6 @@ type Configuration = { */ timeout?: number; - /** - * Switches between existing backend and newer backend - */ - backend?: "v0" | "v1"; - /** * Add additional headers to each request. These may override headers set by the Substrate client. */ @@ -43,7 +38,6 @@ export class Substrate { baseUrl: NonNullable; apiVersion: NonNullable; timeout: NonNullable; - backend: NonNullable; additionalHeaders: NonNullable; /** @@ -54,7 +48,6 @@ export class Substrate { baseUrl, apiVersion, timeout, - backend, additionalHeaders, }: Configuration) { if (!apiKey) { @@ -66,7 +59,6 @@ export class Substrate { this.baseUrl = baseUrl ?? "https://api.substrate.run"; this.apiVersion = apiVersion ?? OpenAPIjson["info"]["version"]; this.timeout = timeout ?? 300_000; - this.backend = backend ?? "v1"; this.additionalHeaders = additionalHeaders ?? {}; } @@ -187,7 +179,6 @@ export class Substrate { headers.append("Content-Type", "application/json"); headers.append("User-Agent", `APIClient/JS ${VERSION}`); headers.append("X-Substrate-Version", this.apiVersion); - headers.append("X-Substrate-Backend", this.backend); // Switch between old and new backends // Auth headers.append("Authorization", `Bearer ${this.apiKey}`); From 179186464e3b59214393e3f7b371e70e2b81e85c Mon Sep 17 00:00:00 2001 From: benzguo Date: Wed, 12 Jun 2024 02:21:37 -0400 Subject: [PATCH 3/3] add backend --- src/Substrate.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Substrate.ts b/src/Substrate.ts index 4bf50b5..8fdcc5e 100644 --- a/src/Substrate.ts +++ b/src/Substrate.ts @@ -179,6 +179,7 @@ export class Substrate { headers.append("Content-Type", "application/json"); headers.append("User-Agent", `APIClient/JS ${VERSION}`); headers.append("X-Substrate-Version", this.apiVersion); + headers.append("X-Substrate-Backend", "v1"); // Auth headers.append("Authorization", `Bearer ${this.apiKey}`);