Skip to content

Conversation

@pasevin
Copy link
Collaborator

@pasevin pasevin commented May 9, 2025

Description

Proactive Network Handling, ABI Transformer Fixes, and UX Enhancements

This Pull Request introduces several key improvements to the Transaction Form Builder, focusing on enhancing the user experience with wallet interactions, ensuring data integrity in ABI transformations, and refining various UI/UX aspects.

Key Features & Fixes:

Wallet Interaction & Network Management

  • Proactive EVM Network Switching (feat(adapter-evm), fix(adapter-evm)):
    • Implemented proactive network switching in the EVM adapter. Users are now prompted to switch their wallet to the correct network if a mismatch is detected during:
      • Wallet connection (connectWallet).
      • Transaction submission (signAndBroadcast).
    • This significantly improves UX by preventing transactions from being sent to the wrong network or failing due to network mismatches.
    • Refactored wallet connection logic into a reusable connectAndEnsureCorrectNetwork function for better maintainability.
    • Updated related tests to mock and cover the new network switching behavior.

Data Integrity & Core Logic

  • ABI Transformation Integrity (fix(adapter), test(adapter)):
    • Addressed a bug in the EVM ABI transformer (abi/transformer.ts) where non-standard properties from raw ABIs (e.g., internalType) were incorrectly propagated into the internal ContractSchema. The transformer now strictly maps only known and defined properties.
    • Added comprehensive unit tests for the ABI transformer.
    • Enhanced JSDoc comments in abi/transformer.ts and the core types/src/contracts/schema.ts to clarify type definitions and adapter roles.
  • Contract Loader Robustness (fix(core)):
    • Fixed an infinite loading loop in the ContractAddressForm that occurred when an address from a different network (or an unverified contract) was entered. The ContractLoader service now correctly propagates errors.

Export System

  • Enhancements & Fixes (refactor(export), fix(export), feat(export)):
    • Cleaned up and refactored aspects of the form export template.
    • Updated onSubmit handling in exported forms.
    • Ensured network configuration is correctly injected and handled in exported applications.
    • Addressed issues with wallet provider state and improved template reliability.
    • Fixed a regression where adapter configurations were not being included in exports.
    • Included the ContractStateWidget in exported forms.

Architecture & Refactoring

  • Core & Adapter Refinements (refactor(core), feat(core), feat(adapter), fix(adapter)):
    • Implemented a singleton adapter provider pattern.
    • Made adapter loading asynchronous and network-aware, consolidating registries.
    • Separated blockchain adapters into individual packages.
    • Applied a domain-driven module structure across EVM, Solana, Stellar, and Midnight adapters.
    • Implemented robust input/output serialization for the EVM adapter.
    • Centralized logger and general utilities in the form-renderer package.

UI/UX Improvements

  • General Enhancements (feat(ui), fix(ui), feat(form)):
    • Improved the transaction action bar, including a more prominent export button and refined styling.
    • Enhanced the ContractStateWidget UI and behavior, including auto-querying of simple view functions and better space efficiency.
    • Removed the "Load Contract" button, relying on automatic loading.
    • Improved transaction status display with a reset button and clearer loading indicators.
    • Enhanced wizard header/footer styling and refined various UI elements for consistency.
    • Refactored the "Execution Method" UI into the "Form Customization" step.

Other Notable Changes:

  • Added transaction confirmation waiting step.
  • Various cleanups, documentation updates, and dependency updates.

This PR aims to deliver a more robust, user-friendly, and maintainable Transaction Form Builder.

pasevin added 30 commits April 11, 2025 09:18
# Conflicts:
#	packages/core/src/adapters/evm/adapter.ts
#	packages/core/src/services/ContractLoader.ts
@netlify
Copy link

netlify bot commented May 9, 2025

👷 Deploy request for transaction-form-builder pending review.

A Netlify team Owner will need to approve the deploy before you can run your build.

Are you a team Owner? Visit the deploys page to approve it

Need more help? Learn more in the Netlify docs

Name Link
🔨 Latest commit e44884a

pasevin added 9 commits May 9, 2025 09:07
Add '@openzeppelin/transaction-form-renderer' and

'@openzeppelin/transaction-form-types' to optimizeDeps.include

in vitest.shared.config.ts.

This aims to resolve 'Failed to resolve entry for package' errors

in Vitest/Vite when core tests import from these workspace packages in CI.
Add '@openzeppelin/transaction-form-renderer' and

'@openzeppelin/transaction-form-types' to ssr.noExternal

in vitest.shared.config.ts.

This ensures these workspace packages are processed by Vite during tests,

aiming to resolve 'Failed to resolve entry for package' errors in CI.
Add optimizeDeps.include and ssr.noExternal for

'@openzeppelin/transaction-form-renderer' and

'@openzeppelin/transaction-form-types' directly to

packages/core/vitest.config.ts.

This addresses Vitest/Vite's failure to resolve these workspace

package entries during tests for the core package in CI.
Add resolve.dedupe for form-renderer, form-types, react,

and react-dom in packages/core/vitest.config.ts.

This attempts to resolve workspace dependency resolution issues

in Vitest/Vite for the core package tests.
Ensure all workspace packages are built using 'pnpm -r build'

before running export-related tests in export-testing.yml.

This mirrors the fix applied to ci.yml and coverage.yml

to prevent module resolution errors during tests.
@pasevin pasevin requested a review from Copilot May 9, 2025 10:14
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 implements proactive network switching for the EVM adapter, fixes issues with ABI transformation by strictly mapping only defined properties, and enhances the overall UI/UX of the Transaction Form Builder.

  • Introduces a reusable function for wallet connection with network validation.
  • Refines ABI loading (from JSON strings and Etherscan), including robust error handling and logging.
  • Updates testing, linters, workflow configurations, and documentation supporting the modular adapter architecture.

Reviewed Changes

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

Show a summary per file
File Description
packages/adapter-evm/src/abi/loader.ts Adds functions for loading and parsing ABIs from JSON and Etherscan with detailed logging and error handling.
packages/adapter-evm/src/abi/index.ts Provides a barrel export for the abi module.
packages/adapter-evm/src/abi/etherscan.ts Implements ABI fetching from Etherscan with appropriate network config validations and JSON parsing.
packages/adapter-evm/src/abi/tests/transformer.test.ts Contains extensive tests for ABI transformation covering various cases.
packages/adapter-evm/src/tests/wallet-connect.test.ts Includes tests validating wallet connection logic using a shared network config.
packages/adapter-evm/src/tests/mocks/mock-network-configs.ts Provides a stable mock network configuration for EVM testing.
packages/adapter-evm/package.json Sets up package metadata and dependencies for the EVM adapter package.
README.md, CONTRIBUTING.md, etc. Updates documentation and workflow configuration to support new adapter modules and enforce adapter architecture.
lint-adapters.cjs, eslint.config.cjs Adjusts file search patterns and lint rules to ensure adapter files comply with the ContractAdapter interface.

@pasevin pasevin merged commit a35b6b3 into main May 9, 2025
6 of 7 checks passed
@github-actions
Copy link
Contributor

github-actions bot commented May 9, 2025

🎉 This PR is included in version 1.2.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@pasevin pasevin deleted the plat-6405-transaction-form-builder-poc-v2 branch May 11, 2025 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant