Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove secretHash from rotate key response #6401

Merged
merged 1 commit into from
Mar 3, 2025
Merged
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
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 @@ -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",
},
};
}}
Expand Down
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);
});
},
);