Fix: Replace deprecated connect() in useScaffoldContract hook#337
Open
Einarmig wants to merge 56 commits intoScaffold-Stark:base-challenge-templatefrom
Open
Fix: Replace deprecated connect() in useScaffoldContract hook#337Einarmig wants to merge 56 commits intoScaffold-Stark:base-challenge-templatefrom
Einarmig wants to merge 56 commits intoScaffold-Stark:base-challenge-templatefrom
Conversation
Co-authored-by: Nadai2010 <nadai2010@proton.me>
…#165) Co-authored-by: metalboyrick <rsulisthio@gmail.com>
…tark#175) [skip ci] Co-authored-by: Nadai <112663528+Nadai2010@users.noreply.github.com> Co-authored-by: Bủ <57097047+Buuh2511@users.noreply.github.com> Co-authored-by: AMD <90222287+michojekunle@users.noreply.github.com>
Co-authored-by: GianMarco <gian@quantum3labs.com> Co-authored-by: tu11aa <thanhtuhr01@gmail.com>
…Stark/speedrunstark into challenge-0-simple-nft
Co-authored-by: gianmalarcon <gian@quantum3labs.com>
Co-authored-by: gianmalarcon <gian@quantum3labs.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: truthixify <124162045+truthixify@users.noreply.github.com>
…oid unexpected conflicts
…oid unexpected conflicts
…oid unexpected conflicts
…oid unexpected conflicts
…eScaffoldContract - Fixes runtime error when connecting wallet and accessing My NFTs - Updates to starknet.js v8 API (account in constructor instead of .connect()) - Maintains backward compatibility with read-only mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Contract Connection Error in useScaffoldContract Hook
Problem
The application was crashing when users connected their wallet and navigated to the "My NFTs" section with the following error:
Error Location:
hooks/scaffold-stark/useScaffoldContract.ts:43Root Cause
The
useScaffoldContracthook was using the deprecated.connect()method from starknet.js v6.x API, which no longer exists in starknet.js v8.x.Old Code (Broken)
Solution
Updated the contract instantiation to use the new starknet.js v8 API, where the account is passed directly in the constructor instead of using a separate
.connect()call.New Code (Fixed)
Impact
Files Changed
packages/nextjs/hooks/scaffold-stark/useScaffoldContract.tsTesting
Types of change