MetaMask / MetaMask/metamask-extension
[HW] OneKey: mUSD conversion from USDC fails with 'not_enough_funds' smart transaction error when there is not sufficient ETH balance
- Dominant language
- TypeScript
- Stars
- 13.2k
- Forks
- 5.6k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 451
Description
## Description
When using a OneKey hardware wallet account, attempting to convert mUSD from USDC on Ethereum mainnet fails with an 'mUSD conversion failed' error. The underlying error indicates a smart transaction publish hook failure due to insufficient funds, falling back to regular transaction submission which also fails. The balance reported is 0 wei despite the account holding USDC.
## Steps to Reproduce
1. Add a hardware wallet and import a OneKey account
2. Ensure the OneKey account holds USDC on Ethereum mainnet without sufficient Ethereum mainnet funds
3. Attempt to convert mUSD from USDC
4. Observe the 'mUSD conversion failed' error
## Expected Result
The mUSD conversion from USDC completes successfully using the OneKey hardware wallet account.
## Actual Result
The conversion fails with the error:
```
Error in smart transaction publish hook, falling back to regular transaction submission Error: Fetch error: {
"status": 422,
"balanceNeededWei": 123522310723407,
"currentBalanceWei": 0,
"detail": "Not enough funds. Balance is only 0 wei and we need 123522310723407 wei at the very least.",
"error": "not_enough_funds"
}
```
The smart transaction service is reporting `currentBalanceWei: 0` despite the account holding funds, suggesting the balance lookup is failing or using the wrong account address for the hardware wallet.
### Detection stage
Release Candidate
### Version
13.46.0 RC
### Build type
RC (Release Candidate)
### Browser
Chrome
### Operating system
MacOS
### Hardware wallet
OneKey
## Additional context
The `balanceNeededWei` of 123522310723407 (~0.000124 ETH) suggests this is a gas estimation for the conversion transaction. The `currentBalanceWei: 0` points to a potential issue with how the smart transaction hook resolves the balance for OneKey hardware wallet accounts specifically.
## Media
https://github.com/user-attachments/assets/51c28102-4f70-4bea-995a-83939e9dd1cc
---
*Filed via Claude bug reporter*
Contributor guide
Research direction
No source files or tests are named. Start by tracing the mUSD conversion flow and its smart transaction publish hook for OneKey hardware-wallet accounts, then inspect how the account address and ETH balance are resolved. Done means the conversion succeeds with USDC and insufficient ETH is handled without reporting a zero balance for the wrong account.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- blockchain
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100