Skip to content

Commit

Permalink
remove secretHash from rotate key response (#6401)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnsdls authored Mar 3, 2025
1 parent f9fa5df commit 33ddf56
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 49 deletions.
1 change: 0 additions & 1 deletion apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ export type RotateSecretKeyAPIReturnType = {
data: {
secret: string;
secretMasked: string;
secretHash: string;
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,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",
},
};
}}
Expand Down
93 changes: 48 additions & 45 deletions packages/thirdweb/src/utils/bytecode/resolveImplementation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
},
);

0 comments on commit 33ddf56

Please sign in to comment.