Skip to content

Commit

Permalink
Merge pull request #202 from pollum-io/fix/rollux-usdc-usdt
Browse files Browse the repository at this point in the history
fix: solve send tx bug with usdc/usdt tokens
  • Loading branch information
lucasgabrielgsp authored Oct 13, 2023
2 parents bbe3361 + f287c91 commit 291c1ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/sysweb3-keyring/src/transactions/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,7 @@ export class EthereumTransactions implements IEthereumTransactions {
maxPriorityFeePerGas,
maxFeePerGas,
gasPrice,
decimals,
gasLimit,
saveTrezorTx,
}: ISendSignedErcTransactionProps): Promise<IResponseFromSendErcSignedTransaction> => {
Expand All @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions packages/sysweb3-keyring/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ export interface ISendSignedErcTransactionProps {
gasPrice?: BigNumberish;
gasLimit?: BigNumberish;
tokenAmount?: string;
decimals?: number;
tokenId?: number;
saveTrezorTx?: (tx: any) => void;
}
Expand Down

0 comments on commit 291c1ae

Please sign in to comment.