From a42529bb6274bed44a1b3ee5f27e35e5418fb472 Mon Sep 17 00:00:00 2001 From: Jonas Daniels Date: Mon, 3 Mar 2025 13:31:48 -0800 Subject: [PATCH] remove secretHash from rotate key response --- .../src/@3rdweb-sdk/react/hooks/useApi.ts | 1 - .../ProjectGeneralSettingsPage.stories.tsx | 5 +- .../bytecode/resolveImplementation.test.ts | 93 ++++++++++--------- 3 files changed, 50 insertions(+), 49 deletions(-) diff --git a/apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts b/apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts index 9dba9002be5..dd0644b6736 100644 --- a/apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts +++ b/apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts @@ -371,7 +371,6 @@ export type RotateSecretKeyAPIReturnType = { data: { secret: string; secretMasked: string; - secretHash: string; }; }; diff --git a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/settings/ProjectGeneralSettingsPage.stories.tsx b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/settings/ProjectGeneralSettingsPage.stories.tsx index a75e9cec2dd..8105a139b5c 100644 --- a/apps/dashboard/src/app/team/[team_slug]/[project_slug]/settings/ProjectGeneralSettingsPage.stories.tsx +++ b/apps/dashboard/src/app/team/[team_slug]/[project_slug]/settings/ProjectGeneralSettingsPage.stories.tsx @@ -72,9 +72,8 @@ function Story(props: { await new Promise((resolve) => setTimeout(resolve, 1000)); return { data: { - secret: new Array(86).fill("x").join(""), - secretHash: new Array(64).fill("x").join(""), - secretMasked: "123...4567", + secret: `sk_${new Array(86).fill("x").join("")}`, + secretMasked: "sk_123...4567", }, }; }} diff --git a/packages/thirdweb/src/utils/bytecode/resolveImplementation.test.ts b/packages/thirdweb/src/utils/bytecode/resolveImplementation.test.ts index 4bb6a96107a..574c57b31b2 100644 --- a/packages/thirdweb/src/utils/bytecode/resolveImplementation.test.ts +++ b/packages/thirdweb/src/utils/bytecode/resolveImplementation.test.ts @@ -20,54 +20,57 @@ import { getContract } from "../../contract/contract.js"; import { deployContract } from "../../contract/deployment/deploy-with-abi.js"; import { resolveImplementation } from "./resolveImplementation.js"; -describe("Resolve implementation", async () => { - it("should extract implementation address for minimal proxy contract", async () => { - const resolved = resolveImplementation(NFT_DROP_CONTRACT); - expect((await resolved).address).to.equal(NFT_DROP_IMPLEMENTATION); - }); - - it("should extract implementation address for matic proxy contract", async () => { - const resolved = resolveImplementation(POLYGON_USDT_PROXY_CONTRACT); - expect((await resolved).address).to.equal( - POLYGON_USDT_IMPLEMENTATION.toLowerCase(), - ); - }); - - it("should extract implementation address for base USDC proxy contract", async () => { - const resolved = resolveImplementation(BASE_USDC_PROXY_CONTRACT); - expect((await resolved).address).to.equal( - BASE_USDC_IMPLEMENTATION.toLowerCase(), - ); - }); - - it("should extract implementation address for ERC1967 proxy contract", async () => { - const implementationAddress = await deployContract({ - client: TEST_CLIENT, - chain: ANVIL_CHAIN, - account: TEST_ACCOUNT_A, - bytecode: DUMMY_BYTECODE, - abi: [], +describe.runIf(process.env.TW_SECRET_KEY)( + "Resolve implementation", + async () => { + it("should extract implementation address for minimal proxy contract", async () => { + const resolved = resolveImplementation(NFT_DROP_CONTRACT); + expect((await resolved).address).to.equal(NFT_DROP_IMPLEMENTATION); }); - const proxyAddress = await deployContract({ - client: TEST_CLIENT, - chain: ANVIL_CHAIN, - account: TEST_ACCOUNT_A, - bytecode: ERC1967_PROXY_BYTECODE, - abi: ERC1967_PROXY_CONSTRUCTOR_ABI as Abi, - constructorParams: { - logic: implementationAddress, - data: "0x", - }, + it("should extract implementation address for matic proxy contract", async () => { + const resolved = resolveImplementation(POLYGON_USDT_PROXY_CONTRACT); + expect((await resolved).address).to.equal( + POLYGON_USDT_IMPLEMENTATION.toLowerCase(), + ); }); - const proxy = getContract({ - chain: ANVIL_CHAIN, - address: proxyAddress, - client: TEST_CLIENT, + it("should extract implementation address for base USDC proxy contract", async () => { + const resolved = resolveImplementation(BASE_USDC_PROXY_CONTRACT); + expect((await resolved).address).to.equal( + BASE_USDC_IMPLEMENTATION.toLowerCase(), + ); }); - const resolved = await resolveImplementation(proxy); - expect(resolved.address).to.equal(implementationAddress); - }); -}); + it("should extract implementation address for ERC1967 proxy contract", async () => { + const implementationAddress = await deployContract({ + client: TEST_CLIENT, + chain: ANVIL_CHAIN, + account: TEST_ACCOUNT_A, + bytecode: DUMMY_BYTECODE, + abi: [], + }); + + const proxyAddress = await deployContract({ + client: TEST_CLIENT, + chain: ANVIL_CHAIN, + account: TEST_ACCOUNT_A, + bytecode: ERC1967_PROXY_BYTECODE, + abi: ERC1967_PROXY_CONSTRUCTOR_ABI as Abi, + constructorParams: { + logic: implementationAddress, + data: "0x", + }, + }); + + const proxy = getContract({ + chain: ANVIL_CHAIN, + address: proxyAddress, + client: TEST_CLIENT, + }); + + const resolved = await resolveImplementation(proxy); + expect(resolved.address).to.equal(implementationAddress); + }); + }, +);