Skip to content

Build/configure vercel - migrate to Sepolia testnet#8

Merged
davidmelendez merged 7 commits into
FutureMindsTeam:mainfrom
davidmelendez:build/configure-vercel
Oct 13, 2025
Merged

Build/configure vercel - migrate to Sepolia testnet#8
davidmelendez merged 7 commits into
FutureMindsTeam:mainfrom
davidmelendez:build/configure-vercel

Conversation

@davidmelendez
Copy link
Copy Markdown
Contributor

@davidmelendez davidmelendez commented Oct 13, 2025

feat: migrate to Sepolia testnet and simplify Randomness UI

📌 Description

This PR migrates the entire project from local devnet to Sepolia testnet and simplifies the Randomness component UI to focus exclusively on the development mode (devnet_generate function). Additionally, it fixes TypeScript build errors on Vercel and improves the handling of invalid contracts in localStorage.

🎯 Motivation and Context

The project needed to be deployed to a public testnet (Sepolia) for broader testing and accessibility. The previous setup was configured only for local devnet, causing deployment failures on Vercel. Additionally, the Randomness component had complex VRF production mode options that were not yet functional, creating confusion for users.

Key issues resolved:

  • ❌ Vercel build failing due to missing minimatch type definitions
  • ❌ Application trying to connect to local devnet (not available in production)
  • ❌ Complex UI showing non-functional production VRF options
  • ❌ localStorage storing invalid contract names causing errors

🛠️ How to Test the Change

  1. 🔹 Visit the deployed application: https://starklottorandoness.vercel.app/debug
  2. 🔹 Connect your Starknet wallet (Argent or Braavos) on Sepolia testnet
  3. 🔹 Navigate to the Debug page and select the "Randomness" contract
  4. 🔹 Enter a seed value and click "🎲 Generar 5 Números Aleatorios"
  5. 🔹 Verify that numbers are generated successfully using devnet_generate
  6. 🔹 Check the Read functions to query generated numbers with get_generation_numbers(id)

🖼️ Screenshots

Production URL: https://starklottorandoness.vercel.app/debug

image

The UI now shows a simplified interface focused on development mode generation.

🔍 Type of Change

  • New Feature - Adds Sepolia testnet support
  • 🐞 Bugfix - Fixes Vercel build errors and localStorage issues
  • 🔄 Refactoring - Simplifies Randomness component UI

📝 Changes Made

1. Vercel Build Fixes

  • Added minimatch@^9.0.3 to devDependencies to resolve TypeScript build errors
  • Configured Vercel environment variable: NEXT_PUBLIC_SEPOLIA_PROVIDER_URL

2. Network Migration (Devnet → Sepolia)

Modified files:

  • packages/nextjs/scaffold.config.ts: Changed targetNetworks from [chains.devnet] to [chains.sepolia]
  • packages/snfoundry/deployments/: Removed devnet_latest.json
  • packages/nextjs/contracts/deployedContracts.ts: Regenerated with only Sepolia contracts

3. Randomness Component Simplification

File: packages/nextjs/app/debug/_components/contract/RandomnessComponent.tsx

Removed:

  • ❌ Production VRF multicall options (request_randomness_prod)
  • ❌ Safe Mode and Force Dev Mode toggles
  • ❌ VRF Coordinator configuration section
  • ❌ Problematic account validation
  • ❌ Complex debugging sections

Simplified to:

  • ✅ Clean UI focused on devnet_generate function
  • ✅ Spanish language labels for better UX
  • ✅ Clear "how it works" section
  • ✅ Simple input and button interface

4. localStorage Handling Improvements

File: packages/nextjs/app/debug/_components/DebugContracts.tsx

  • Added validation to handle contracts stored in localStorage that no longer exist
  • Improved error handling when switching between networks with different contracts

5. Code Cleanup

File: packages/nextjs/services/web3/provider.ts

  • Removed temporary debug logs

✅ Checklist Before Merging

  • 🧪 I have tested the code and it works as expected on Sepolia testnet
  • 🎨 My changes follow the project's coding style
  • 📖 I have updated component documentation inline
  • ⚠️ No new warnings or errors were introduced
  • 🔍 I have reviewed and approved my own code before submitting

📌 Additional Notes

Environment Variables Required

The following environment variable must be configured in Vercel:
NEXT_PUBLIC_SEPOLIA_PROVIDER_URL=https://starknet-sepolia.public.blastapi.io/rpc/v0_7

Future Work

  • Production VRF mode with Cartridge will be re-enabled once the VRF integration is stable
  • The commented-out production code in RandomnessComponent.tsx is preserved for future implementation

Contract Addresses (Sepolia)

  • Randomness Contract: 0x2e91ef979c67ef901846fed17a9d72c9c745536266d01962339076bd7717714

Known Limitations

  • Currently using devnet_generate for random number generation (local algorithm with seed)
  • VRF production mode temporarily disabled until Cartridge VRF integration is complete

…o Sepolia, and modify RandomnessComponent with new contract addresses and temporary dev mode implementation for randomness generation.
…terface for randomness generation, and remove unused code for improved clarity and performance.
…amline error handling and improve code clarity.
@davidmelendez davidmelendez self-assigned this Oct 13, 2025
Copy link
Copy Markdown
Contributor

@kimcascante kimcascante left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@davidmelendez davidmelendez merged commit e9448de into FutureMindsTeam:main Oct 13, 2025
2 checks passed
@davidmelendez davidmelendez deleted the build/configure-vercel branch October 13, 2025 18:40
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.

3 participants