diff --git a/packages/sysweb3-keyring/src/transactions/ethereum.ts b/packages/sysweb3-keyring/src/transactions/ethereum.ts index d4af166..be93b4b 100644 --- a/packages/sysweb3-keyring/src/transactions/ethereum.ts +++ b/packages/sysweb3-keyring/src/transactions/ethereum.ts @@ -848,6 +848,7 @@ export class EthereumTransactions implements IEthereumTransactions { maxPriorityFeePerGas, maxFeePerGas, gasPrice, + decimals, gasLimit, saveTrezorTx, }: ISendSignedErcTransactionProps): Promise => { @@ -868,9 +869,13 @@ export class EthereumTransactions implements IEthereumTransactions { getErc20Abi(), walletSigned ); - const calculatedTokenAmount = ethers.BigNumber.from( - ethers.utils.parseEther(tokenAmount as string) + decimals + ? ethers.utils.parseUnits( + tokenAmount as string, + this.toBigNumber(decimals as number) + ) + : ethers.utils.parseEther(tokenAmount as string) ); let transferMethod; if (isLegacy) { diff --git a/packages/sysweb3-keyring/src/types.ts b/packages/sysweb3-keyring/src/types.ts index 445bf33..83a89f3 100644 --- a/packages/sysweb3-keyring/src/types.ts +++ b/packages/sysweb3-keyring/src/types.ts @@ -329,6 +329,7 @@ export interface ISendSignedErcTransactionProps { gasPrice?: BigNumberish; gasLimit?: BigNumberish; tokenAmount?: string; + decimals?: number; tokenId?: number; saveTrezorTx?: (tx: any) => void; }