Fix stale @starknet-react/core import and cairo test arity mismatch - #21
Merged
Conversation
app/page.tsx still imported useBlockNumber from the old @starknet-react/core package name; the repo migrated to @starknet-start/react everywhere else. test_set_greeting_no_allowance called set_greeting with 2 args instead of the 3 the contract requires, failing compilation (E2030) before tests could even run.
5 tasks
Contributor
Author
|
Additional proof requested: `yarn format:check` / `scarb fmt --check` both pass clean (exit 0) on this branch — no reformatting needed. |
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.
Summary
app/page.tsx:8importeduseBlockNumberfrom@starknet-react/core, the old package name. The repo migrated to@starknet-start/react(declared as^1.0.8in package.json); every other hook usage already points there. Repointed the import —@starknet-start/reactdoes exportuseBlockNumber, verified against the package's type declarations.contracts/tests/test_contract.cairo:110calledset_greeting(new_greeting, Option::Some(500))with 2 args; the contract signature takes 3 (new_greeting,option_amount,option_token), causing a compile error (E2030) that failed the whole test suite before any test could run. Added the missing token arg (Option::Some(ETH_TOKEN_CONTRACT_ADDRESS), matching the siblingtest_transfer_ethpattern at line 59) so the call now exercises the intended "insufficient allowance" panic path.Diff is two lines of source changed (plus the corresponding cairo call reformatting) — no refactors, no unrelated cleanup.
deployedContracts.tsuntouched (D1, out of scope).Proof (pasted command output)
Compile:
⏭️ Skipping compilation - all contracts are up to date(contracts/src unchanged by this PR)Test:
Compile-clean (E2030 gone) and full pass, including the 3
#[fork("SEPOLIA_LATEST")]tests (network was reachable this run).next:check-types: exit 0, clean (verified against a real deploy so the "Strk"|"Eth" narrowing from the empty
deployedContracts.tsstub isn't masking anything)yarn build: succeeded, all 8 routes generated
next dev (port 3002):
curl -o /dev/null -w HTTP_STATUS http://127.0.0.1:3002/→HTTP_STATUS:200Test plan
yarn compileyarn test(5/5 pass)yarn next:check-types(exit 0)cd packages/nextjs && yarn buildnext devon port 3002,curl/→ 200