Skip to content

Pnpm migration, sync hyperlane, bump dependency#168

Merged
raihannismara merged 1 commit into
mainfrom
pnpm-migration
Apr 6, 2026
Merged

Pnpm migration, sync hyperlane, bump dependency#168
raihannismara merged 1 commit into
mainfrom
pnpm-migration

Conversation

@raihannismara
Copy link
Copy Markdown

…dependency) (#163)

With the inclusion of Smart Accounts (EIP-7702) the UI was incorrectly showing the recipient banner check for address that are smart accounts and not smart contracts

  • This PR introduces check if the contract code starts with the EIP-7702 selector to decide if the UI should show the warning banner or not
  • Refactors contract address check into its own util function
  • Bug Fixes
  • Improved contract address detection to accurately distinguish between smart accounts and regular contracts.
  • Enhanced error reporting with clearer contextual messages during address validation.

✏️ Tip: You can customize this high-level summary in your review settings.

Migrate package manager from Yarn 4.x (Berry) to pnpm 10.x, following the patterns established in the monorepo migration (hyperlane-monorepo#7410).

Changes:

  • Update packageManager to pnpm@10.25.0

  • Convert resolutions to pnpm.overrides

  • Convert yarn patches to pnpm.patchedDependencies format

  • Pin dependency versions to match yarn.lock (pnpm re-resolves ^ ranges to latest):

    • @cosmos-kit/react: 2.18.0
    • @solana/wallet-adapter-wallets: 0.19.16
    • @rainbow-me/rainbowkit: 2.2.0
  • Add phantom dependencies required by pnpm strict dependency isolation

  • Update CI workflows to use pnpm (pnpm/action-setup@v4, pnpm store caching)

  • Update GitHub Actions to latest versions (checkout@v6, setup-node@v6)

  • Update vercel.json to use pnpm@10.25.0

  • Update README with pnpm commands

  • Remove yarn files (.yarn/, .yarnrc.yml, yarn.lock)

  • Add pnpm-lock.yaml

  • Fix unit testing

  • Update husky

  • pnpm install succeeds

  • pnpm typecheck passes

  • pnpm build succeeds

  • pnpm lint passes

  • CI workflows pass

🤖 Generated with Claude Code

  • New Features

  • Added support for Solana wallet integrations, Sentry error monitoring, and additional Chakra UI packages.

  • Chores

  • Migrated project tooling, package manager metadata, and CI workflows from Yarn to pnpm; updated GitHub Actions and dev tooling versions.

  • Upgraded and added multiple dependencies and devDependencies; replaced resolution/patch approach with pnpm-compatible overrides.

  • Documentation

    • Updated CLI/README commands and ignore lists to reflect pnpm usage.

✏️ Tip: You can customize this high-level summary in your review settings.


  • chore: delete yarn related, update the way fetch in react-query

  • fix: max button not calculated from balances, dynamic estimated fee

  • chore: bump depedency hyperlane 20.1.0

  • Fix/metamask mobile walletconnect chain switch (Fix/metamask mobile walletconnect chain switch #160)

  • fix: ensure wallet is on origin chain before EVM transactions

WalletConnect with MetaMask mobile can take several seconds after a chain switch before the wagmi store reflects the new chain. The hardcoded 2-second sleep in @hyperlane-xyz/widgets is often not enough, causing the chain-ID assertion to fail with ChainMismatchError.

Add waitForChainSwitch to poll getAccount().chainId every 500 ms (up to 30 s) and ensureWalletOnChain to call switchChain then wait. Call ensureWalletOnChain in executeTransfer before every EVM transaction so the wallet is confirmed on the correct chain before the widgets layer runs its own check.

  • test: add unit tests for waitForChainSwitch and ensureWalletOnChain

Cover all branches of the two new rpcUtils helpers with fake-timer tests: immediate resolution, polling until chain updates, timeout with descriptive error, switchChain rejection swallowing, and the full 30 s default timeout path.

Add EVM-specific tests to useTokenTransfer to verify ensureWalletOnChain is called with the correct wagmiConfig and chainId, that a ChainMismatchError surfaces the right toast, and that preEstimateGasForEvmTxs is invoked after the chain guard succeeds.

Race wallet confirm() against direct blockchain polling with Fibonacci backoff to handle WalletConnect wallets that fail to resolve the confirmation callback. Uses 5s initial delay, Fibonacci intervals (1s, 1s, 2s, 3s... capped at 30s), and 1-hour max poll duration.

  • feat: add event-based tx confirmation for Safe wallet support

Safe wallets return a safeTxHash (internal meta-transaction hash) from sendTransaction instead of an on-chain txHash. Both the wallet confirm callback and RPC polling use the public client to look up this hash, but it never exists on-chain — causing transfers to hang indefinitely.

Add a third racing leg to resilientConfirm that watches for contract events on-chain via eth_getLogs. When the Safe executes the transaction, the target contract emits events (ERC20 Transfer, Approval, etc.) where the Safe address appears as an indexed topic. The event watcher detects this and extracts the real on-chain txHash from the log entry.

This approach is completely chain-agnostic — works on any EVM chain with any Safe deployment without needing to know Safe infrastructure URLs.

Key changes:

  • Add pollForContractEvent with Fibonacci backoff event polling
  • Extend resilientConfirm to support 3-leg race (wallet + RPC + events)
  • Pass contract address and sender from useTokenTransfer for event filtering
  • Extract real on-chain txHash from receipt for explorer links
  • Capture block number before initial delay with 10-block safety buffer
  • prettier

  • fix: estimate gas per-tx instead of all upfront

Gas pre-estimation for all transactions was running before any were sent. For multi-tx flows (approval + transferRemote), the transferRemote gas estimation would fail because the token allowance wasn't set yet — the simulation reverts without the approval in place.

With no gasLimit set, wagmi falls back to estimating gas through the WalletConnect connector's rpcMap during sendTransaction, which can be CORS-blocked or time out, causing the transferRemote request to never reach the Safe wallet.

Fix by estimating gas for each transaction immediately before sending it, so by the time transferRemote is estimated, all prior approvals are confirmed on-chain and the simulation uses the correct allowance state.

  • fix: detect Safe transferRemote via ExecutionSuccess event

The event-based polling only watched the target contract for logs where the sender is an indexed topic. This works for ERC20 Approval (owner is indexed) but fails for transferRemote: the warp router emits SentTransferRemote(destination, recipient, amount) with no sender topic, so the Safe tx was never detected.

Fix: each polling cycle now also queries the sender address (the Safe contract itself) for logs where the wallet-returned hash appears as a topic. Safe emits ExecutionSuccess(bytes32 indexed txHash, payment) when any tx executes — txHash equals the safeTxHash from sendTransaction. This is fully chain-agnostic; no Safe infrastructure URLs required.

  • use raw data on top of topic log

  • add test

  • refactor: remove redundant RPC polling leg from resilientConfirm

confirm() in @hyperlane-xyz/widgets calls wagmi's waitForTransactionReceipt via the public client (raceTransport), not through the WalletConnect relay. The RPC polling leg was therefore a duplicate of what confirm() already does internally. Remove it.

What stays:

  • Event-based polling (pollForContractEvent): the only mechanism that can detect Safe wallet transactions. Safe returns a safeTxHash that waitForTransactionReceipt cannot resolve, so confirm() hangs indefinitely for Safe wallets. Event polling detects the actual on-chain tx via logs.
  • Revert detection: wallet leg now explicitly checks receipt.status === 'reverted' since waitForTransactionReceipt returns success even for reverted transactions.
  • ensureWalletOnChain / waitForChainSwitch: added from staging to ensure wallet chain state is correct before submitting EVM transactions.
  • refactor: extract Safe wallet confirmation into safeWalletUtils

Move fibonacciDelays, abortableSleep, pollForContractEvent, ResilientConfirmOptions, and resilientConfirm out of rpcUtils.ts into a dedicated safeWalletUtils.ts. rpcUtils.ts now only contains RPC transport (raceTransport, raceViemProviderBuilder, withWcRpcFirst), gas estimation (preEstimateGasForEvmTxs), and chain switching (waitForChainSwitch, ensureWalletOnChain).

Corresponding tests moved to safeWalletUtils.test.ts. useTokenTransfer.ts imports resilientConfirm from the new module.


  • chore: deleted patch 18 unused

  • chore: upgrate ci/cd with v4, fix ut approval not covered the test

  • chore: update ci/cd due error when install the package

  • fix ut when ci/cd trigged


…dependency) (#163)

* chore: bump hyperlane version

* fix: isSmartContract check for EIP-7702 addresses to not show banner (hyperlane-xyz#850)

With the inclusion of Smart Accounts ([EIP-7702](https://eip7702.io/))
the UI was incorrectly showing the recipient banner check for address
that are smart accounts and not smart contracts

- This PR introduces check if the contract code starts with the EIP-7702
selector to decide if the UI should show the warning banner or not
- Refactors contract address check into its own util function

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **Bug Fixes**
* Improved contract address detection to accurately distinguish between
smart accounts and regular contracts.
* Enhanced error reporting with clearer contextual messages during
address validation.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

* c
feat: add preview fee estimate before bridge

* feat: estimate gas preview

* feat!: pnpm migration (hyperlane-xyz#840)

Migrate package manager from Yarn 4.x (Berry) to pnpm 10.x, following
the patterns established in the monorepo migration
([hyperlane-monorepo#7410](hyperlane-xyz/hyperlane-monorepo#7410)).

**Changes:**
- Update `packageManager` to pnpm@10.25.0
- Convert `resolutions` to `pnpm.overrides`
- Convert yarn patches to `pnpm.patchedDependencies` format
- Pin dependency versions to match yarn.lock (pnpm re-resolves `^`
ranges to latest):
  - `@cosmos-kit/react`: 2.18.0
  - `@solana/wallet-adapter-wallets`: 0.19.16
  - `@rainbow-me/rainbowkit`: 2.2.0
- Add phantom dependencies required by pnpm strict dependency isolation
- Update CI workflows to use pnpm (pnpm/action-setup@v4, pnpm store
caching)
- Update GitHub Actions to latest versions (checkout@v6, setup-node@v6)
- Update vercel.json to use pnpm@10.25.0
- Update README with pnpm commands
- Remove yarn files (.yarn/, .yarnrc.yml, yarn.lock)
- Add pnpm-lock.yaml
- Fix unit testing
- Update husky

- [x] `pnpm install` succeeds
- [x] `pnpm typecheck` passes
- [x] `pnpm build` succeeds
- [x] `pnpm lint` passes
- [x] CI workflows pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

* **New Features**
* Added support for Solana wallet integrations, Sentry error monitoring,
and additional Chakra UI packages.

* **Chores**
* Migrated project tooling, package manager metadata, and CI workflows
from Yarn to pnpm; updated GitHub Actions and dev tooling versions.
* Upgraded and added multiple dependencies and devDependencies; replaced
resolution/patch approach with pnpm-compatible overrides.

* **Documentation**
  * Updated CLI/README commands and ignore lists to reflect pnpm usage.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* chore: delete yarn related, update the way fetch in react-query

* fix: max button not calculated from balances, dynamic estimated fee

* chore: bump depedency hyperlane 20.1.0

* Fix/metamask mobile walletconnect chain switch (#160)

* fix: ensure wallet is on origin chain before EVM transactions

WalletConnect with MetaMask mobile can take several seconds after a
chain switch before the wagmi store reflects the new chain. The
hardcoded 2-second sleep in @hyperlane-xyz/widgets is often not
enough, causing the chain-ID assertion to fail with ChainMismatchError.

Add waitForChainSwitch to poll getAccount().chainId every 500 ms (up to
30 s) and ensureWalletOnChain to call switchChain then wait. Call
ensureWalletOnChain in executeTransfer before every EVM transaction so
the wallet is confirmed on the correct chain before the widgets layer
runs its own check.

* test: add unit tests for waitForChainSwitch and ensureWalletOnChain

Cover all branches of the two new rpcUtils helpers with fake-timer
tests: immediate resolution, polling until chain updates, timeout with
descriptive error, switchChain rejection swallowing, and the full 30 s
default timeout path.

Add EVM-specific tests to useTokenTransfer to verify ensureWalletOnChain
is called with the correct wagmiConfig and chainId, that a
ChainMismatchError surfaces the right toast, and that preEstimateGasForEvmTxs
is invoked after the chain guard succeeds.

* feat: Safe wallet support via event-based tx confirmation (#157)

* feat: add resilient tx confirmation with RPC polling fallback

Race wallet confirm() against direct blockchain polling with Fibonacci
backoff to handle WalletConnect wallets that fail to resolve the
confirmation callback. Uses 5s initial delay, Fibonacci intervals
(1s, 1s, 2s, 3s... capped at 30s), and 1-hour max poll duration.

* feat: add event-based tx confirmation for Safe wallet support

Safe wallets return a safeTxHash (internal meta-transaction hash) from
sendTransaction instead of an on-chain txHash. Both the wallet confirm
callback and RPC polling use the public client to look up this hash,
but it never exists on-chain — causing transfers to hang indefinitely.

Add a third racing leg to resilientConfirm that watches for contract
events on-chain via eth_getLogs. When the Safe executes the transaction,
the target contract emits events (ERC20 Transfer, Approval, etc.) where
the Safe address appears as an indexed topic. The event watcher detects
this and extracts the real on-chain txHash from the log entry.

This approach is completely chain-agnostic — works on any EVM chain with
any Safe deployment without needing to know Safe infrastructure URLs.

Key changes:
- Add pollForContractEvent with Fibonacci backoff event polling
- Extend resilientConfirm to support 3-leg race (wallet + RPC + events)
- Pass contract address and sender from useTokenTransfer for event filtering
- Extract real on-chain txHash from receipt for explorer links
- Capture block number before initial delay with 10-block safety buffer

* prettier

* fix: estimate gas per-tx instead of all upfront

Gas pre-estimation for all transactions was running before any were sent.
For multi-tx flows (approval + transferRemote), the transferRemote gas
estimation would fail because the token allowance wasn't set yet —
the simulation reverts without the approval in place.

With no gasLimit set, wagmi falls back to estimating gas through the
WalletConnect connector's rpcMap during sendTransaction, which can be
CORS-blocked or time out, causing the transferRemote request to never
reach the Safe wallet.

Fix by estimating gas for each transaction immediately before sending it,
so by the time transferRemote is estimated, all prior approvals are
confirmed on-chain and the simulation uses the correct allowance state.

* fix: detect Safe transferRemote via ExecutionSuccess event

The event-based polling only watched the target contract for logs
where the sender is an indexed topic. This works for ERC20 Approval
(owner is indexed) but fails for transferRemote: the warp router
emits SentTransferRemote(destination, recipient, amount) with no
sender topic, so the Safe tx was never detected.

Fix: each polling cycle now also queries the sender address (the Safe
contract itself) for logs where the wallet-returned hash appears as a
topic. Safe emits ExecutionSuccess(bytes32 indexed txHash, payment)
when any tx executes — txHash equals the safeTxHash from
sendTransaction. This is fully chain-agnostic; no Safe infrastructure
URLs required.

* use raw data on top of topic log

* add test

* refactor: remove redundant RPC polling leg from resilientConfirm

confirm() in @hyperlane-xyz/widgets calls wagmi's waitForTransactionReceipt
via the public client (raceTransport), not through the WalletConnect relay.
The RPC polling leg was therefore a duplicate of what confirm() already does
internally. Remove it.

What stays:
- Event-based polling (pollForContractEvent): the only mechanism that can
  detect Safe wallet transactions. Safe returns a safeTxHash that
  waitForTransactionReceipt cannot resolve, so confirm() hangs indefinitely
  for Safe wallets. Event polling detects the actual on-chain tx via logs.
- Revert detection: wallet leg now explicitly checks receipt.status === 'reverted'
  since waitForTransactionReceipt returns success even for reverted transactions.
- ensureWalletOnChain / waitForChainSwitch: added from staging to ensure
  wallet chain state is correct before submitting EVM transactions.

* refactor: extract Safe wallet confirmation into safeWalletUtils

Move fibonacciDelays, abortableSleep, pollForContractEvent,
ResilientConfirmOptions, and resilientConfirm out of rpcUtils.ts into
a dedicated safeWalletUtils.ts. rpcUtils.ts now only contains RPC
transport (raceTransport, raceViemProviderBuilder, withWcRpcFirst),
gas estimation (preEstimateGasForEvmTxs), and chain switching
(waitForChainSwitch, ensureWalletOnChain).

Corresponding tests moved to safeWalletUtils.test.ts.
useTokenTransfer.ts imports resilientConfirm from the new module.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: deleted patch 18 unused

* chore: upgrate ci/cd with v4, fix ut approval not covered the test

* chore: update ci/cd due error when install the package

* fix ut when ci/cd trigged

---------

Co-authored-by: Jason Guo <33064781+Xaroz@users.noreply.github.com>
Co-authored-by: Paul Balaji <10051819+paulbalaji@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: derryld3 <derryl@d3labs.io>
@raihannismara raihannismara requested a review from derryld3 April 6, 2026 05:14
@raihannismara raihannismara self-assigned this Apr 6, 2026
@raihannismara raihannismara changed the title Pnpm migration Pnpm migration, sync hyperlane, bump dependecy Apr 6, 2026
@raihannismara raihannismara changed the title Pnpm migration, sync hyperlane, bump dependecy Pnpm migration, sync hyperlane, bump dependency Apr 6, 2026
@raihannismara raihannismara merged commit ae08569 into main Apr 6, 2026
5 of 6 checks passed
@raihannismara raihannismara deleted the pnpm-migration branch April 6, 2026 05:47
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