Skip to content

Conversation

@fretchen
Copy link
Owner

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR completes Phase 3 of the multi-chain expansion project by migrating CollectorNFT components from local contract configuration to the shared @fretchen/chain-utils package. The migration follows the established pattern from Phase 2 (GenImNFT migration) and enables the CollectorNFT to support multi-chain deployment in the future.

Changes:

  • Added CollectorNFTv1ABI to @fretchen/chain-utils with minimal ABI containing only the functions needed by the website
  • Migrated SimpleCollectButton component to use useAutoNetwork() hook with deferred chain switching
  • Removed collectorNFTContractConfig from legacy configuration, keeping only LLMv1 (out of scope for multi-chain)
  • Updated documentation to reflect Phase 3 completion

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
shared/chain-utils/src/abi/CollectorNFTv1.ts New minimal ABI for CollectorNFTv1 with getMintStats and mintCollectorNFT functions
shared/chain-utils/src/abi/index.ts Added export for CollectorNFTv1ABI
website/components/SimpleCollectButton.tsx Migrated to use useAutoNetwork() hook and chain-utils, adds network switching before transaction
website/test/SimpleCollectButton.test.tsx Updated mocks for useAutoNetwork and chain-utils, removed obsolete network check test
website/utils/getChain.ts Removed collectorNFTContractConfig, preserved getChain() for LLMv1, updated comments
website/components/MyNFTList.tsx Removed unnecessary SupportedChainId type cast (unrelated cleanup)
website/MULTICHAIN_EXPANSION_PROPOSAL.md Updated to mark Phase 3 as complete with implementation details

outputs: [
{ name: "mintCount", type: "uint256" },
{ name: "currentPrice", type: "uint256" },
{ name: "lastMinter", type: "address" },
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

The documented ABI output at line 553 shows lastMinter as the third output parameter, but the actual contract (CollectorNFTv1.sol line 181) and the implemented ABI (CollectorNFTv1.ts line 18) correctly use nextPrice. This documentation should be updated to match the actual implementation.

Suggested change
{ name: "lastMinter", type: "address" },
{ name: "nextPrice", type: "uint256" },

Copilot uses AI. Check for mistakes.
Comment on lines 51 to 70
setIsLoading(true);

// Ensure correct network before transaction
const switched = await switchIfNeeded();
if (!switched) {
setIsLoading(false);
return;
}

const [, currentPrice] = mintStats as [bigint, bigint, bigint];

writeContract({
...collectorNFTContractConfig,
address: getCollectorNFTAddress(network),
abi: CollectorNFTv1ABI,
functionName: "mintCollectorNFT",
args: [genImTokenId], // CollectorNFTv1 doesn't need URI parameter
value: currentPrice,
});

setIsLoading(false);
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

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

Setting isLoading(false) immediately after calling writeContract() creates a potential timing issue. The writeContract() function is non-blocking, so isLoading becomes false before isPending becomes true, which could briefly enable the button between states.

For consistency with other components in the codebase (see NFTCard.tsx lines 264-295), consider either:

  1. Remove the custom isLoading state entirely and rely solely on wagmi's isPending and isConfirming states, OR
  2. Keep isLoading true and let it be cleared by the success/error handlers, similar to ImageGenerator.tsx line 293

The current pattern is inconsistent with the rest of the codebase.

Copilot uses AI. Check for mistakes.
@fretchen fretchen merged commit c2d885c into main Jan 31, 2026
7 checks passed
@fretchen fretchen deleted the img_base branch January 31, 2026 18:23
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.

2 participants