Skip to content

Fix stale @starknet-react/core import and cairo test arity mismatch - #21

Merged
tu11aa merged 1 commit into
step-2from
fix/step-2-frontend-and-cairo-test
Jul 31, 2026
Merged

Fix stale @starknet-react/core import and cairo test arity mismatch#21
tu11aa merged 1 commit into
step-2from
fix/step-2-frontend-and-cairo-test

Conversation

@tu11aa

@tu11aa tu11aa commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • app/page.tsx:8 imported useBlockNumber from @starknet-react/core, the old package name. The repo migrated to @starknet-start/react (declared as ^1.0.8 in package.json); every other hook usage already points there. Repointed the import — @starknet-start/react does export useBlockNumber, verified against the package's type declarations.
  • contracts/tests/test_contract.cairo:110 called set_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 sibling test_transfer_eth pattern 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.ts untouched (D1, out of scope).

Proof (pasted command output)

Compile: ⏭️ Skipping compilation - all contracts are up to date (contracts/src unchanged by this PR)

Test:

Collected 5 test(s) from contracts package
Running 0 test(s) from src/
Running 5 test(s) from tests/
[PASS] contracts_integrationtest::test_contract::test_withdraw_not_owner
[PASS] contracts_integrationtest::test_contract::test_set_greetings
[PASS] contracts_integrationtest::test_contract::test_set_greeting_no_allowance
[PASS] contracts_integrationtest::test_contract::test_transfer_eth
[PASS] contracts_integrationtest::test_contract::test_transfer_strk
Tests: 5 passed, 0 failed, 0 ignored, 0 filtered out

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.ts stub 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:200

Test plan

  • yarn compile
  • yarn test (5/5 pass)
  • yarn next:check-types (exit 0)
  • cd packages/nextjs && yarn build
  • next dev on port 3002, curl / → 200

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.
@tu11aa

tu11aa commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

Additional proof requested: `yarn format:check` / `scarb fmt --check` both pass clean (exit 0) on this branch — no reformatting needed.

@tu11aa
tu11aa merged commit a13f37d into step-2 Jul 31, 2026
1 check failed
@tu11aa
tu11aa deleted the fix/step-2-frontend-and-cairo-test branch July 31, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant