Skip to content

Commit

Permalink
browse without keplr
Browse files Browse the repository at this point in the history
  • Loading branch information
wotori committed Mar 29, 2022
1 parent 2884b59 commit 3d4ae4b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/components/NFBrowser/NFBrowser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const PUBLIC_CW721_CONTRACT = process.env
.NEXT_PUBLIC_APP_CW721_CONTRACT as string;

const NFBrowser = observer(() => {
const { walletAddress, signingClient, connectWallet } = useSigningClient();
const { client } = useSigningClient();
const [manyNFT, setManyNFT] = useState<Nft[]>([]);

useEffect(() => {
Expand All @@ -41,10 +41,9 @@ const NFBrowser = observer(() => {
const isDatabase = devStore.dataPlatform === "Database";

if (isProduction || isBlockchain) {
if (!signingClient) return;
if (walletAddress.length === 0) connectWallet();
if (!client) return;

signingClient
client
.queryContractSmart(PUBLIC_CW721_CONTRACT, { num_tokens: {} })
.then((res: any) => {
const manyMetadata: Promise<Metadata>[] = [];
Expand All @@ -53,7 +52,7 @@ const NFBrowser = observer(() => {
for (let i = 1; i <= res.count; i++) {
if (!EXCLUDE_LIST.includes(i)) {
manyMetadata.push(
signingClient.queryContractSmart(PUBLIC_CW721_CONTRACT, {
client.queryContractSmart(PUBLIC_CW721_CONTRACT, {
all_nft_info: { token_id: i + "" },
})
);
Expand Down Expand Up @@ -88,14 +87,14 @@ const NFBrowser = observer(() => {
.catch((error: any) => {
if (process.env.NODE_ENV === "development") {
console.error(
`Error signingClient.queryContractSmart() num_tokens: ${error}`
`Error client.queryContractSmart() num_tokens: ${error}`
);
}
});
} else if (isDevelopment && isDatabase) {
setManyNFT(nftService.getNFTFromDatabase());
}
}, [signingClient, walletAddress, alert]);
}, [client, alert]);

return (
<div className={styles.nftBrowser}>
Expand Down

0 comments on commit 3d4ae4b

Please sign in to comment.