Step 5 – Utility Modules & Environment Variables

Authentication screens compile now, but they reference several helper files we haven’t created yet. In this step we’ll:

  1. Add ABIs and helper code under /common/utils

  2. Declare any missing .env keys

  3. Verify that /sign-up and /login pages render without red import errors

5.1 Folder Structure

common/
└─ utils/
   ├─ MagmarSimpleAccountFactory.json
   ├─ NFTContract.json
   ├─ client.ts
   └─ Loader.tsx

5.2 Magmar SimpleAccountFactory ABI

common/utils/MagmarSimpleAccountFactory.json

[
  { "inputs":[{ "internalType":"contract IEntryPoint","name":"_entryPoint","type":"address"}], "stateMutability":"nonpayable","type":"constructor" },
  { "inputs":[], "name":"accountImplementation", "outputs":[{ "internalType":"contract SimpleAccount","name":"","type":"address"}], "stateMutability":"view","type":"function" },
  { "inputs":[{ "internalType":"address","name":"owner","type":"address" },{ "internalType":"uint256","name":"salt","type":"uint256" }], "name":"createAccount", "outputs":[{ "internalType":"contract SimpleAccount","name":"ret","type":"address"}], "stateMutability":"nonpayable","type":"function" },
  { "inputs":[{ "internalType":"address","name":"owner","type":"address" },{ "internalType":"uint256","name":"salt","type":"uint256" }], "name":"getAddress", "outputs":[{ "internalType":"address","name":"","type":"address"}], "stateMutability":"view","type":"function" }
]

Address (Sepolia)0x9406Cc6185a346906296840746125a0E44976454 Store it in .env for easy edits later.


5.3 RPC Helper (viem)

common/utils/client.ts


5.4 DaisyUI Loader

common/utils/Loader.tsx


5.5 Demo NFT Contract ABI

common/utils/NFTContract.json (abbreviated for brevity – include full ABI in your repo)


5.6 Environment Variables

Add or update .env.local:


5.7 Compile Check

Navigate to:

  • http://localhost:3000/sign-up

  • http://localhost:3000/login

Both pages should load without import errors. Submitting the forms will still fail because /api/get-signer is not implemented yet—that’s intentional.

Last updated