Koniverse / SubWallet-Extension

SubWallet is the comprehensive non-custodial wallet solution for Polkadot, Substrate & Ethereum ecosystems.
https://www.subwallet.app
Apache License 2.0
94 stars 65 forks source link

Rounded `value` parameter send in EVM transaction request #3632

Open youPickItUp opened 2 months ago

youPickItUp commented 2 months ago

Describe the bug

I have a problem where value parameter in EVM transaction request is getting rounded. It behaves as if converted to js Number primitive therefor I suspect this line:

https://github.com/Koniverse/SubWallet-Extension/blob/a3c0a9cf92a9c55c9841595d4ddae31cd08a357c/packages/extension-base/src/services/request-service/handler/EvmRequestHandler.ts#L217

I'm using Aleph Zero EVM (Testnet) network, where native token has 18 decimals. I've connected to dApp with SubWallet Extension. I've submitted a transaction with value having 18 decimals. The transaction failed, because a value send was lower than expected. I've traced it back here :smile:

To Reproduce Steps to reproduce the behavior:

  1. Import account with private key: edc6526d959b4b3555ac8fe7d15f349103893cd603398d72086c34e518d29281

  2. Go to https://test.common.fi/bridge

  3. Select Aleph Zero EVM Testnet on top and Aleph Zero Testnet on bottom

  4. Connect SubWallet on both ends of the bridge

  5. image

  6. The account has some funds (I've transfered a little there, if it's missing there is faucet here)

  7. In input paste 1.169847813119247738

  8. Click Bridge. Transfer will fail, because value send will be 1.1698478131192478

Expected behavior Parameter value shouldn't be rounded.

Desktop (please complete the following information):

Additional context SubWallet v1.2.28

It seems transferring precise amount with 18 decimals doesn't work as well, but it seems to be unrelated to the issue at hand.

nampc1 commented 2 months ago

Thanks @youPickItUp, we'll have a look asap