Skip to content

Commit

Permalink
ref: update starknetid hooks for mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
irisdv committed Mar 8, 2024
1 parent b184249 commit a9ead28
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
14 changes: 2 additions & 12 deletions packages/core/src/hooks/useStarkAddress.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions packages/core/src/hooks/useStarkProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)],
},
{
Expand Down

0 comments on commit a9ead28

Please sign in to comment.