From 1933e93b6d6168741fa1cb78f0d7e214c4d8da97 Mon Sep 17 00:00:00 2001 From: Leon Date: Tue, 17 Dec 2024 09:11:23 +0800 Subject: [PATCH] fix: Scdo amount type (#6355) --- packages/kit-bg/src/providers/ProviderApiScdo.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/kit-bg/src/providers/ProviderApiScdo.ts b/packages/kit-bg/src/providers/ProviderApiScdo.ts index 485b5f5227e..8f572643697 100644 --- a/packages/kit-bg/src/providers/ProviderApiScdo.ts +++ b/packages/kit-bg/src/providers/ProviderApiScdo.ts @@ -1,5 +1,6 @@ import { web3Errors } from '@onekeyfe/cross-inpage-provider-errors'; import { IInjectedProviderNames } from '@onekeyfe/cross-inpage-provider-types'; +import BigNumber from 'bignumber.js'; import * as ethUtils from 'ethereumjs-util'; import { keccak256 } from 'viem'; @@ -141,6 +142,12 @@ class ProviderApiScdo extends ProviderApiBase { '"from" address is invalid for this account', ); } + if (typeof encodedTx.Amount === 'string') { + const amount = new BigNumber(encodedTx.Amount); + if (amount.isInteger()) { + encodedTx.Amount = amount.toNumber(); + } + } const result = await this.backgroundApi.serviceDApp.openSignAndSendTransactionModal({ request,