feat: implement adapter architecture phases 1 and 2#446
feat: implement adapter architecture phases 1 and 2#446fernandomg wants to merge 16 commits intodevelopfrom
Conversation
…y, and useChainRegistry
Add @precondition, @postcondition, @throws, and @invariant JSDoc annotations to all public SDK methods matching the spec contracts. Add missing runtime precondition enforcement: - switchChain() now checks connected state before chain validation - execute() now validates params.chainId against supportedChains
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
Implements Phases 1–2 of the adapter architecture, introducing chain-agnostic adapter primitives and migrating key UI flows to adapter-backed hooks while reorganizing domains (wallet/transactions/tokens/core/data/contracts).
Changes:
- Added chain registry primitives, adapter interfaces, EVM adapter implementations, and adapter composition utilities.
- Introduced
DAppBoosterProvider+ React SDK hooks/components (useWallet,useTransaction,WalletGuard, adapter-agnostic connect/sign/tx buttons). - Reorganized app domains (
core/,wallet/,transactions/,tokens/,data/,contracts/) and updated demo pages/tests accordingly.
Reviewed changes
Copilot reviewed 253 out of 256 changed files in this pull request and generated 20 comments.
Show a summary per file
| File | Description |
|---|---|
| typedoc.json | Updates TypeDoc excludes to match new folder layout (core/contracts/wallet/data). |
| src/wallet/types.ts | Re-exports legacy wallet types for compatibility. |
| src/wallet/providers/Web3Provider.tsx | Reintroduces legacy Wagmi/Query/Web3 provider wrapper for older entrypoints. |
| src/wallet/providers.ts | Re-exports adapter-agnostic ConnectWalletButton from the SDK. |
| src/wallet/hooks/useWalletStatus.ts | Adds deprecated wallet status helper on top of useWeb3Status. |
| src/wallet/hooks.ts | Barrel export for wallet hooks. |
| src/wallet/connectors/wagmi.config.ts | Centralizes shared wagmi config/connector choice for SDK + generated hooks. |
| src/wallet/connectors/reown.config.tsx | Legacy Reown/Web3Modal connector setup (example config). |
| src/wallet/connectors/rainbowkit.config.tsx | Legacy RainbowKit connector setup (commented example). |
| src/wallet/connectors/portoInit.ts | Optional Porto initialization gated by env. |
| src/wallet/connectors/connectkit.config.tsx | Legacy ConnectKit connector config + custom connect button/avatar. |
| src/wallet/components/WalletStatusVerifier.tsx | Deprecated verifier component + connected-status context helper. |
| src/wallet/components/SwitchChainButton.tsx | Adds a styled SwitchChain button. |
| src/wallet/components/ConnectButton/styles.ts | Adds ConnectButton theme styles via CSS variables. |
| src/wallet/components.ts | Wallet UI barrel exports. |
| src/transactions/providers/TransactionNotificationProvider.test.tsx | Adds regression tests for toast error handling and rejection behavior. |
| src/transactions/providers.ts | Barrel export for transaction notification provider/hook. |
| src/transactions/components/TransactionButton.tsx | Migrates to adapter-backed useWallet/useTransaction flow. |
| src/transactions/components/SignButton.tsx | Migrates signing flow to adapter-backed useWallet + registry. |
| src/transactions/components.ts | Transactions UI barrel exports (legacy + new buttons). |
| src/tokens/utils/tokenListsCache.ts | Adds a token list cache utility for startup-loaded token lists. |
| src/tokens/types/index.ts | Introduces Zod schemas + token list typing. |
| src/tokens/types.ts | Token public types + schema re-exports for consumers. |
| src/tokens/hooks/useTokenSearch.ts | Adds deferred token search hook. |
| src/tokens/hooks/useErc20Balance.ts | Adds ERC20 balance hook via wagmi public client + react-query. |
| src/tokens/hooks.ts | Tokens hooks barrel export. |
| src/tokens/config/tokenLists.ts | Adds default token lists configuration. |
| src/tokens/components/TokenSelect/utils.tsx | Adds chainId resolution helper for TokenSelect. |
| src/tokens/components/TokenSelect/types.ts | Defines TokenSelect network selector types. |
| src/tokens/components/TokenSelect/TopTokens/Item.tsx | Adds top-token item UI. |
| src/tokens/components/TokenSelect/TopTokens/index.tsx | Adds top-tokens grid selection. |
| src/tokens/components/TokenSelect/styles.ts | Adds TokenSelect theme styles via CSS variables. |
| src/tokens/components/TokenSelect/Search/NetworkButton.tsx | Adds network dropdown trigger button UI. |
| src/tokens/components/TokenSelect/Search/Input.tsx | Adds TokenSelect search input styling and icon. |
| src/tokens/components/TokenSelect/Search/index.tsx | Adds combined search + network dropdown UI. |
| src/tokens/components/TokenSelect/List/VirtualizedList.tsx | Adds virtualized list helper using @tanstack/react-virtual. |
| src/tokens/components/TokenSelect/List/TokenBalance.tsx | Adds token balance renderer with suspense wrapper. |
| src/tokens/components/TokenSelect/List/index.tsx | Adds TokenSelect list rendering with virtualization + empty state. |
| src/tokens/components/TokenSelect/List/AddERC20TokenButton.tsx | Adds “Add token to wallet” control (legacy/web3Status-based). |
| src/tokens/components/TokenInput/useTokenInput.tsx | Adds TokenInput state/balance management hook. |
| src/tokens/components/TokenInput/styles.ts | Adds TokenInput theme styles via CSS variables. |
| src/tokens/components.ts | Tokens components barrel export. |
| src/sdk/react/provider/index.ts | Exposes provider API for React SDK. |
| src/sdk/react/provider/context.ts | Defines provider context shape + internal useProviderContext. |
| src/sdk/react/lifecycle/index.ts | Exposes notification lifecycle factory/types. |
| src/sdk/react/lifecycle/createNotificationLifecycle.ts | Adds toast-based transaction lifecycle implementation. |
| src/sdk/react/index.ts | React SDK barrel export (components/hooks/lifecycle/provider). |
| src/sdk/react/hooks/useReadOnly.ts | Adds minimal read-only client hook driven by registered factories. |
| src/sdk/react/hooks/useReadOnly.test.ts | Adds tests for read-only hook behavior. |
| src/sdk/react/hooks/useChainRegistry.ts | Adds hook to access ChainRegistry from provider context. |
| src/sdk/react/hooks/useChainRegistry.test.ts | Adds tests for registry hook + adapter-sourced chain data. |
| src/sdk/react/hooks/index.ts | React hooks barrel export. |
| src/sdk/react/components/WalletGuard.tsx | Adds adapter-based wallet gating component (replacement for legacy verifier). |
| src/sdk/react/components/index.ts | React components barrel export. |
| src/sdk/react/components/ConnectWalletButton.tsx | Adds adapter-agnostic connect/account button. |
| src/sdk/core/utils/wrap-adapter.ts | Adds adapter wrapping utility for before/after/error hooks. |
| src/sdk/core/utils/wrap-adapter.test.ts | Adds unit tests for adapter wrapping behavior. |
| src/sdk/core/utils/index.ts | Core utils barrel export. |
| src/sdk/core/index.ts | Core SDK barrel export (adapters/chain/errors/evm/utils). |
| src/sdk/core/evm/wallet.integration.test.ts | Adds integration tests for EVM wallet adapter using wagmi mock connector. |
| src/sdk/core/evm/types.ts | Defines EVM payload/config types shared across core/react layers. |
| src/sdk/core/evm/pre-steps.ts | Adds approval/permit pre-step helpers producing adapter PreSteps. |
| src/sdk/core/evm/pre-steps.test.ts | Adds tests for pre-step helper outputs. |
| src/sdk/core/evm/index.ts | EVM module barrel export (chains/connectors/wallet/tx/presteps/server wallet). |
| src/sdk/core/evm/connectors/reown.tsx | Adds Reown/AppKit connector implementation for SDK. |
| src/sdk/core/evm/connectors/rainbowkit.tsx | Adds RainbowKit connector implementation for SDK. |
| src/sdk/core/evm/connectors/index.ts | EVM connector barrel export. |
| src/sdk/core/evm/connectors/connectors.test.ts | Adds tests validating connector surfaces. |
| src/sdk/core/evm/connectors/connectkit.tsx | Adds ConnectKit connector implementation for SDK. |
| src/sdk/core/evm/chains.ts | Adds viem Chain → ChainDescriptor conversion. |
| src/sdk/core/chain/registry.ts | Adds immutable ChainRegistry with conflict detection and cross-type lookup normalization. |
| src/sdk/core/chain/index.ts | Chain module barrel export (descriptor/registry/explorer). |
| src/sdk/core/chain/explorer.ts | Adds registry-backed explorer URL builder. |
| src/sdk/core/chain/descriptor.ts | Defines chain descriptor types (CAIP-2, explorer, endpoints, address config). |
| src/sdk/core/adapters/wallet.ts | Defines WalletAdapter interface and supporting types. |
| src/sdk/core/adapters/transaction.ts | Defines TransactionAdapter interface and supporting types. |
| src/sdk/core/adapters/provider.ts | Defines provider configuration and adapter bundle types. |
| src/sdk/core/adapters/lifecycle.ts | Defines wallet/transaction lifecycle hook types. |
| src/sdk/core/adapters/index.ts | Adapters module barrel export. |
| src/sdk/core/adapters/index.test.ts | Compile-time export surface test for adapter types. |
| src/routes/__root.tsx | Switches app shell to DAppBoosterProvider + adapter wiring, removes legacy provider usage. |
| src/lib/wallets/web3modal.config.tsx | Updates JSX intrinsic elements for AppKit button. |
| src/hooks/useWeb3Status.tsx | Marks legacy useWeb3Status as deprecated. |
| src/hooks/useWalletStatus.ts | Marks legacy useWalletStatus as deprecated. |
| src/data/types.ts | Adds placeholder export for data domain typing surface. |
| src/data/adapters/subgraph/queries/uniswap/pools.ts | Moves example Uniswap subgraph query under data domain. |
| src/data/adapters/subgraph/queries/readme.txt | Documents example queries usage for subgraph codegen. |
| src/data/adapters/subgraph/queries/aave/reserves.ts | Moves example Aave subgraph query under data domain. |
| src/data/adapters/subgraph/codegen.ts | Moves subgraph codegen config under data domain. |
| src/core/utils/strings.ts | Adds truncation utilities for hashes/strings. |
| src/core/utils/printAppInfo.ts | Adds console app info printer. |
| src/core/utils/logger.ts | Adds basic timing logger gated by dev mode. |
| src/core/utils/hash.test.ts | Updates/relocates tests for hash detection utilities. |
| src/core/utils/getExplorerLink.ts | Relocates explorer link helper under core utils. |
| src/core/utils/DeveloperError.ts | Introduces DeveloperError type for non-retryable errors. |
| src/core/utils/address.ts | Adds env-based native token address matcher. |
| src/core/utils.ts | Creates consolidated core utils barrel export. |
| src/core/ui/SwitchThemeButton/styles.ts | Adds CSS-variable theme styles for theme toggle. |
| src/core/ui/SwitchThemeButton/assets/Dark.tsx | Adds Dark theme icon component. |
| src/core/ui/Spinner/styles.ts | Adds CSS-variable theme styles for spinner. |
| src/core/ui/Spinner/index.tsx | Adds themed Spinner wrapper. |
| src/core/ui/SecondaryButton/styles.ts | Adds themed SecondaryButton styles. |
| src/core/ui/SecondaryButton/index.tsx | Adds SecondaryButton component wrapper. |
| src/core/ui/PrimaryButton/styles.ts | Adds themed PrimaryButton styles. |
| src/core/ui/PrimaryButton/index.tsx | Adds PrimaryButton component wrapper. |
| src/core/ui/NotificationToast.tsx | Adds notification toaster UI (still wired to legacy wallet hook). |
| src/core/ui/Modal/styles.ts | Adds themed modal styles. |
| src/core/ui/Menu/styles.ts | Adds themed menu styles. |
| src/core/ui/Menu/index.tsx | Adds MenuContent/MenuItem wrappers with theme vars. |
| src/core/ui/Inner.tsx | Adds layout container component. |
| src/core/ui/Header/styles.ts | Adds themed header styles. |
| src/core/ui/Header/MobileMenu/styles.ts | Adds themed mobile menu styles. |
| src/core/ui/Header/index.tsx | Migrates header to new core/ui folder and new ConnectWalletButton import path. |
| src/core/ui/HashInput.test.tsx | Updates/relocates HashInput tests. |
| src/core/ui/Hash.tsx | Adds hash display component using new truncation util. |
| src/core/ui/Hash.test.tsx | Adds tests for Hash component rendering behaviors. |
| src/core/ui/GeneralMessage/styles.ts | Adds GeneralMessage theme styling. |
| src/core/ui/Footer/styles.ts | Adds themed footer styles. |
| src/core/ui/Footer/Socials/index.tsx | Adds footer social links list. |
| src/core/ui/Footer/Socials/assets/Twitter.tsx | Adds Twitter/X icon component. |
| src/core/ui/Footer/Socials/assets/Telegram.tsx | Adds Telegram icon component. |
| src/core/ui/Footer/Socials/assets/LinkedIn.tsx | Adds LinkedIn icon component. |
| src/core/ui/Footer/index.tsx | Adds footer component wired to package version. |
| src/core/ui/ExternalLink/styles.ts | Adds themed external link styles. |
| src/core/ui/ExplorerLink.tsx | Adds explorer link UI component using explorer URL utility. |
| src/core/ui/ExplorerLink.test.tsx | Adds tests for ExplorerLink behavior. |
| src/core/ui/DropdownButton.tsx | Adds dropdown button wrapper and chevron icon behavior. |
| src/core/ui/dev/TanStackRouterDevtools.tsx | Migrates router devtools wrapper under core/ui/dev. |
| src/core/ui/dev/TanStackReactQueryDevtools.tsx | Migrates query devtools wrapper under core/ui/dev. |
| src/core/ui/CopyButton/styles.ts | Adds themed copy button styles. |
| src/core/ui/chakra/tooltip.tsx | Adds Chakra tooltip wrapper with portal controls. |
| src/core/ui/chakra/toaster.tsx | Adds Chakra toaster wrapper for general toasts. |
| src/core/ui/chakra/provider.tsx | Adds Chakra provider + theme tokens + next-themes integration. |
| src/core/ui/chakra/color-mode.tsx | Adds next-themes ThemeProvider wrapper. |
| src/core/ui/Button.tsx | Adds base button primitive via chakra() factory. |
| src/core/ui/BigNumberInput.test.tsx | Updates/relocates BigNumberInput tests. |
| src/core/ui/Avatar.tsx | Adds avatar component with react-jazzicon CJS interop handling. |
| src/core/ui/Avatar.test.tsx | Adds tests for Avatar rendering behavior. |
| src/core/types/utils.ts | Adds shared type helper(s). |
| src/core/types.ts | Creates consolidated core types barrel export. |
| src/core/hooks/useNetworkBlockNumber.ts | Adds hook to fetch any-chain block number via viem client. |
| src/core/hooks.ts | Core hooks barrel export. |
| src/core/config/networks.config.ts | Centralizes chain/transports configuration under core/config. |
| src/core/config/common.ts | Adds common flags (isDev, includeTestnets) under core/config. |
| src/core/components.ts | Creates consolidated core UI components barrel export. |
| src/contracts/wagmi/config.ts | Moves wagmi CLI codegen config to contracts domain. |
| src/contracts/abis/OPL1CrossDomainMessengerProxy.ts | Moves ABI definitions to contracts domain. |
| src/contracts/abis/AaveFaucet.ts | Moves ABI definitions to contracts domain. |
| src/components/sharedComponents/WalletStatusVerifier.tsx | Updates legacy verifier to import ConnectWalletButton from new wallet path and adds deprecations. |
| src/components/sharedComponents/WalletStatusVerifier.test.tsx | Updates verifier tests to mock the new ConnectWalletButton path. |
| src/components/sharedComponents/ui/Header/MobileMenu/MobileMenu.tsx | Updates legacy header mobile menu connect button import path. |
| src/components/sharedComponents/ui/Header/index.tsx | Updates legacy header connect button import path. |
| src/components/sharedComponents/SignButton.tsx | Migrates legacy sign button to adapter-backed signing flow. |
| src/components/pageComponents/NotFound404.tsx | Updates imports to new core components barrel. |
| src/components/pageComponents/NotFound404.test.tsx | Fixes router mock to preserve original module exports. |
| src/components/pageComponents/home/Welcome/index.tsx | Updates layout import to new core components barrel. |
| src/components/pageComponents/home/Examples/Item/index.tsx | Updates Modal import to new core components barrel. |
| src/components/pageComponents/home/Examples/index.tsx | Updates Inner import to new core components barrel. |
| src/components/pageComponents/home/Examples/demos/TransactionButton/NativeToken.tsx | Updates imports to new core/transactions/wallet paths while retaining legacy tx demo. |
| src/components/pageComponents/home/Examples/demos/TransactionButton/index.tsx | Updates wallet guard/verifier import path. |
| src/components/pageComponents/home/Examples/demos/TransactionButton/index.test.tsx | Updates mocks to new wallet/sdk hook paths. |
| src/components/pageComponents/home/Examples/demos/TransactionButton/ERC20ApproveAndTransferButton/MintUSDC.tsx | Updates contracts + legacy tx button + wallet context import paths. |
| src/components/pageComponents/home/Examples/demos/TransactionButton/ERC20ApproveAndTransferButton/index.tsx | Updates generated hooks + utils + token type + wallet context imports. |
| src/components/pageComponents/home/Examples/demos/TransactionButton/ERC20ApproveAndTransferButton/ERC20ApproveAndTransferButton.tsx | Updates generated hooks + utils + token types + wallet hook imports. |
| src/components/pageComponents/home/Examples/demos/TokenInput/index.tsx | Updates to new tokens hooks/components + wallet hook paths. |
| src/components/pageComponents/home/Examples/demos/TokenDropdown/index.tsx | Updates TokenDropdown + token types import paths. |
| src/components/pageComponents/home/Examples/demos/TokenDropdown/index.test.tsx | Updates mocks to new tokens components barrel. |
| src/components/pageComponents/home/Examples/demos/SwitchNetwork/index.tsx | Updates wallet components/hooks import paths. |
| src/components/pageComponents/home/Examples/demos/SwitchNetwork/index.test.tsx | Updates mocks to new wallet hooks/providers barrels. |
| src/components/pageComponents/home/Examples/demos/subgraphs/SubgraphStatus/index.tsx | Updates Spinner + suspense util imports to core. |
| src/components/pageComponents/home/Examples/demos/subgraphs/Subgraph/index.tsx | Updates Copy/ExternalLink/toaster + subgraph query import paths. |
| src/components/pageComponents/home/Examples/demos/SignMessage/index.tsx | Updates to new SignButton + WalletStatusVerifier and core button imports. |
| src/components/pageComponents/home/Examples/demos/SignMessage/index.test.tsx | Updates mocks to new wallet hook/provider paths. |
| src/components/pageComponents/home/Examples/demos/OptimismCrossDomainMessenger/index.tsx | Updates contracts/hooks + core utils/components + wallet context import paths. |
| src/components/pageComponents/home/Examples/demos/HashHandling/index.tsx | Updates HashInput/Spinner + wallet hook + utils type import paths. |
| src/components/pageComponents/home/Examples/demos/HashHandling/index.test.tsx | Updates mocks to new wallet hook path + core hash util path. |
| src/components/pageComponents/home/Examples/demos/HashHandling/Hash.tsx | Updates Hash/toaster + explorer link util imports to core. |
| src/components/pageComponents/home/Examples/demos/EnsName/index.tsx | Updates Spinner import path. |
| src/components/pageComponents/home/Examples/demos/EnsName/index.test.tsx | Fixes wagmi mock to preserve original module exports. |
| src/components/pageComponents/home/Examples/demos/ConnectWallet/index.tsx | Updates ConnectWalletButton import path to new wallet providers barrel. |
| src/components/pageComponents/home/Examples/demos/ConnectWallet/index.test.tsx | Updates mock to new wallet providers barrel. |
| setupTests.ts | Adjusts jsdom ResizeObserver stubbing for Chakra/floating-ui dependencies. |
| resume.txt | Adds working notes / status recap file. |
| pnpm-lock.yaml | Updates lockfile for dependency range changes. |
| package.json | Moves scripts/paths to new folders; adjusts dependency semver ranges. |
| index.html | Simplifies font loading and removes extra SEO/prefetch snippets. |
| .install-files/home/Examples/index.tsx | Updates install template import paths to new core components barrel. |
| .gitignore | Updates ignored generated outputs and local folders for new structure. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| justifyContent="center" | ||
| overflow="hidden" | ||
| width={`${ICON_SIZE}px"`} | ||
| > | ||
| <TokenLogo |
There was a problem hiding this comment.
width has an extra quote in the template literal (${ICON_SIZE}px"), which will produce an invalid CSS value and may break layout. Remove the stray quote so the computed width is a valid length.
| lineHeight="1.2" | ||
| _groupHover={{ | ||
| color: 'var(--top-token-item-color-hover, var(--top-token-item-color)', | ||
| }} | ||
| > |
There was a problem hiding this comment.
The CSS variable fallback string is missing a closing ) (it ends with var(--top-token-item-color) instead of ...))). This results in invalid CSS and the hover color won’t apply.
| paddingX={4} | ||
| paddingY={0} | ||
| transition="border-color var({durations.slow}), color var({durations.slow}), background-color var({durations.slow})" | ||
| _focusWithin={{ |
There was a problem hiding this comment.
This transition string uses var({durations.slow}), which is not valid CSS and is inconsistent with other transitions in the codebase (which use {durations.*} token placeholders). Fix the transition value so it resolves to a valid duration token.
| 'html.dark &': { | ||
| '--background-color': '#23048', | ||
| '--text-color': '#c5c2cb', | ||
| '--line-color': '#5f6178', | ||
| }, |
There was a problem hiding this comment.
Dark theme background color #23048 is not a valid hex color (5 digits). This will be ignored by the browser and break footer theming. Use a valid 3/6/8-digit hex value.
| textDecoration: 'none', | ||
| transition: | ||
| 'background-color {durations.moderate}, border-color {durations.moderate}, color {durations.moderate', | ||
| userSelect: 'none', |
There was a problem hiding this comment.
The transition string is missing the closing }/text for the last duration token (it ends at color {durations.moderate). This produces invalid CSS and may cause transitions to be dropped. Close the token and ensure the full transition string is valid.
| const publicClient = usePublicClient({ chainId: token?.chainId }) | ||
|
|
There was a problem hiding this comment.
usePublicClient is keyed off token?.chainId (the initial hook param) rather than selectedToken?.chainId. If the selected token changes, native balance reads can use the wrong chain client.
| } = useQuery({ | ||
| queryKey: ['nativeBalance', selectedToken?.address, selectedToken?.chainId, userWallet], | ||
| queryFn: () => publicClient?.getBalance({ address: getAddress(userWallet ?? '') }), | ||
| enabled: isNative, | ||
| }) |
There was a problem hiding this comment.
This native balance query can run when userWallet is undefined (enabled whenever isNative is true), which will call getAddress('') and throw. Gate enabled on !!userWallet (and ideally !!publicClient) and avoid calling getAddress with an empty string.
| const enabled = !!address && !!token && !isNativeToken(token.address) | ||
| const publicClient = usePublicClient({ chainId: token?.chainId }) | ||
|
|
There was a problem hiding this comment.
enabled doesn’t include !!publicClient, so the query may run with publicClient undefined and silently resolve balance as undefined. Include !!publicClient in enabled (or throw a clear error) to avoid indeterminate results.
| <ConnectButton | ||
| isConnected={status.connected} | ||
| onClick={status.connected ? openAccountModal : openConnectModal} | ||
| > |
There was a problem hiding this comment.
When connected, onClick uses openAccountModal, but that function is optional and may be undefined. In that case the button becomes a no-op; use openAccountModal ?? openConnectModal for the connected case.
| if (networks !== undefined) { | ||
| // we prioritze the wallet chainId over the app chainId because it may be valid in this case, | ||
| // but not supported by the app to interact with but as a read-only chain. | ||
| if (typeof walletChainId === 'number' && networks.some(({ id }) => id === walletChainId)) { |
There was a problem hiding this comment.
Comment typo: "we prioritze" should be "we prioritize".
Description
Implements Phases 1 and 2 of the adapter architecture, transforming dAppBooster from an EVM-only starter template into a chain-agnostic, headless-first SDK.
Phase 1 -- Introduce adapters alongside existing code (no breaking changes):
ChainDescriptor,ChainRegistry,getExplorerUrlWalletAdapter,TransactionAdapter,TransactionLifecycle,WalletLifecyclecreateEvmWalletAdapter(wagmi/actions),createEvmTransactionAdapter(viem),createEvmServerWallet(private key signer)useConnectModalhook withopenAccountsupportcreateApprovalPreStep,createPermitPreStepwrapAdapterutility for adapter composition (logging, analytics)AdapterNotFoundError,TransactionNotReadyError,CapabilityNotSupportedError)DAppBoosterProviderwith per-adapter connect modal resolution via bridge componentsuseWallet,useTransaction,useMultiWallet,useReadOnly,useChainRegistryPhase 2 -- Migrate internals to adapter-backed hooks:
TransactionButton->useTransaction()+useWallet()SignButton->useWallet().signMessage()+useChainRegistry()WalletGuardreplacesWalletStatusVerifier(acceptschainIdandchainTypefor adapter resolution)ConnectWalletButtonis adapter-agnostic (usesuseWallet+openConnectModal/openAccountModal, no wagmi imports)chainId/chainTypeuseWeb3Status,useWalletStatus) marked@deprecatedonSign,onSignComplete,onSignError) dispatched during signing flowssrc/wallet/,src/transactions/,src/tokens/,src/contracts/,src/core/,src/data/src/wallet/connectors/wagmi.config.ts) ensures SDK adapter and generated contract hooks use a single config instanceuseProviderContextremoved from public barrel exports (internal-only hook)Phase 2 pending (tracked in spec, deferred to next PR):
These are sequential — each unblocks the next:
useReadOnlyto accept address param and auto-contribute read factories from adapters (currently minimal stub)useTokens,TokenSelect,AddERC20TokenButton) off deprecateduseWeb3Status→ useuseWallet+useReadOnly(blocked by step 1)TransactionNotificationProviderwithcreateNotificationLifecyclewired as global lifecycle hooks inDAppBoosterProviderconfig (depends onuseWeb3Statusremoval from step 2)LegacyTransactionButton→ adapter-basedTransactionButtonwithTransactionParams(blocked by step 3 — demos need notifications working)Review fixes included:
connect()validates chainId against supportedChains (ChainNotSupportedError)useTransactiongates submission onprepare.ready(TransactionNotReadyError), dispatchesonReplacelifecycle on tx replacementuseConnectModal)openAccountModaladded to connector hooks for disconnect/account management (RainbowKit uses separate modal, ConnectKit/Reown use single modal for both)AdapterNotFoundErrorfor not-found cases in bothuseTransactionanduseWallet(was incorrectly usingAmbiguousAdapterError)CapabilityNotSupportedErrorfor unsupportedsignTypedDatachainTypevssupportedChainsconsistency at initializationChainRegistryConflictErrorfor genuinely conflicting chain descriptorswalletEntriesinsideuseMemoto avoid unnecessary context rebuilds)ConnectWalletButtonimports repointed fromWeb3Providerto SDK path (eliminates dual import surface)replacement.transactionReceipt,privateKeyToAccountfromviem/accounts)TransactionNotificationProvidererror toast type fix (was showing errors as success) and double-await elimination inwatchTxConnectWalletButtoncomponent touseConnectModalhook across all 3 connectorswagmi.config.tsas single source of truth@precondition,@postcondition,@throws,@invariantJSDoc annotations on all public SDK methods matching spec contracts. Added missing runtime precondition checks (switchChainconnected guard,executechain support validation)Architecture spec updated (docs/architecture/adapter-architecture-spec.md):
getSigner,useConnectModalhook pattern, params-at-execute pattern foruseTransaction)Steps
pnpm installcp .env.example .env.local(setPUBLIC_APP_NAMEandPUBLIC_WALLETCONNECT_PROJECT_ID)pnpm dev-- app runs withDAppBoosterProvider+ ConnectKit connectorLegacyTransactionButton, signing demos work via new SDK hookssrc/wallet/connectors/wagmi.config.ts(e.g.connectkitConnectortorainbowkitConnectororreownConnector)Type of change
How Has This Been Tested?
509 tests passing (65 test files). Full
tsc --noEmitclean. Biome lint clean. Pre-commit hooks (lint-staged + vitest related) and commitlint pass on all commits. Manual testing of wallet connection, connector swap, and demo page flows.Remember to check that
Screenshots
N/A -- no visual changes. UI components preserve existing Chakra styling. The adapter architecture is a structural/API change.