Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/verify-status-apikey-quote.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"thirdweb": patch
---

checkVerificationStatus sends the explorer API key without a trailing double quote
39 changes: 39 additions & 0 deletions packages/thirdweb/src/contract/verification/index.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { HttpResponse, http } from "msw";
import { setupServer } from "msw/node";
import { afterAll, afterEach, beforeAll, describe, expect, it } from "vitest";
import { checkVerificationStatus } from "./index.js";

const server = setupServer();

describe("checkVerificationStatus", () => {
beforeAll(() => server.listen({ onUnhandledRequest: "error" }));
afterAll(() => server.close());
afterEach(() => server.resetHandlers());

it("sends the API key unchanged", async () => {
let apikey: string | null = null;
server.use(
http.get("https://api.etherscan.test/api", ({ request }) => {
apikey = new URL(request.url).searchParams.get("apikey");
return HttpResponse.json({
message: "OK",
result: "Pass - Verified",
status: "1",
});
}),
);

const result = await checkVerificationStatus({
explorerApiKey: "TEST_API_KEY",
explorerApiUrl: "https://api.etherscan.test/api",
guid: "test-guid",
});

expect(apikey).toBe("TEST_API_KEY");
expect(result).toEqual({
message: "OK",
result: "Pass - Verified",
status: "1",
});
}, 10_000);
});
2 changes: 1 addition & 1 deletion packages/thirdweb/src/contract/verification/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ type CheckVerificationStatusOptions = {
export async function checkVerificationStatus(
options: CheckVerificationStatusOptions,
): Promise<unknown> {
const endpoint = `${options.explorerApiUrl}?module=contract&action=checkverifystatus&guid=${options.guid}&apikey=${options.explorerApiKey}"`;
const endpoint = `${options.explorerApiUrl}?module=contract&action=checkverifystatus&guid=${options.guid}&apikey=${options.explorerApiKey}`;
return new Promise((resolve, reject) => {
const intervalId = setInterval(async () => {
try {
Expand Down
Loading