From a9ead2835637d52c7df3514dfbb06c75ba026838 Mon Sep 17 00:00:00 2001 From: Iris Date: Fri, 8 Mar 2024 09:43:59 +0100 Subject: [PATCH 1/2] ref: update starknetid hooks for mainnet --- packages/core/src/hooks/useStarkAddress.ts | 14 ++------------ packages/core/src/hooks/useStarkProfile.ts | 5 +---- 2 files changed, 3 insertions(+), 16 deletions(-) diff --git a/packages/core/src/hooks/useStarkAddress.ts b/packages/core/src/hooks/useStarkAddress.ts index fa2b8073..42565743 100644 --- a/packages/core/src/hooks/useStarkAddress.ts +++ b/packages/core/src/hooks/useStarkAddress.ts @@ -1,11 +1,5 @@ import { useMemo } from "react"; -import { - CallData, - Provider, - ProviderInterface, - RawArgs, - starknetId, -} from "starknet"; +import { CallData, Provider, ProviderInterface, starknetId } from "starknet"; import { UseQueryProps, UseQueryResult, useQuery } from "~/query"; import { useProvider } from "./useProvider"; @@ -91,14 +85,10 @@ function queryFn({ const namingContract = contract ?? StarknetIdNamingContract[network]; const p = new Provider(provider); const encodedDomain = decodeDomain(name); - const calldata: RawArgs = - network === "mainnet" - ? { domain: encodedDomain } - : { domain: encodedDomain, hint: [] }; const result = await p.callContract({ contractAddress: namingContract as string, entrypoint: "domain_to_address", - calldata: CallData.compile(calldata), + calldata: CallData.compile({ domain: encodedDomain, hint: [] }), }); // StarknetID returns 0x0 if no name is found, but that can be dangerous diff --git a/packages/core/src/hooks/useStarkProfile.ts b/packages/core/src/hooks/useStarkProfile.ts index 8fa495e7..87227a4e 100644 --- a/packages/core/src/hooks/useStarkProfile.ts +++ b/packages/core/src/hooks/useStarkProfile.ts @@ -188,10 +188,7 @@ function queryFn({ { execution: staticExecution(), to: hardcoded(naming), - selector: - network === "mainnet" - ? hardcoded(hash.getSelectorFromName("domain_to_token_id")) - : hardcoded(hash.getSelectorFromName("domain_to_id")), + selector: hardcoded(hash.getSelectorFromName("domain_to_id")), calldata: [arrayReference(0, 0)], }, { From 61eda85fdfb2f1ca7eb3eb32bfa718b28578afba Mon Sep 17 00:00:00 2001 From: Iris Date: Mon, 11 Mar 2024 08:50:53 +0100 Subject: [PATCH 2/2] chore: add changeset --- .changeset/heavy-taxis-hunt.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/heavy-taxis-hunt.md diff --git a/.changeset/heavy-taxis-hunt.md b/.changeset/heavy-taxis-hunt.md new file mode 100644 index 00000000..0a74ee3f --- /dev/null +++ b/.changeset/heavy-taxis-hunt.md @@ -0,0 +1,5 @@ +--- +"@starknet-react/core": minor +--- + +update starknetid hooks to work with latest version of starknetid contracts