From e72cb9f7f702cac87e3c59aad2f5d22f1cb2dd5e Mon Sep 17 00:00:00 2001 From: JavidHaji-zada Date: Fri, 1 Dec 2023 15:13:53 +0400 Subject: [PATCH] Merge branch 'dev' into stage --- src/components/modular/TokenLogo/index.tsx | 13 ++++++++---- src/hooks/query/useTokensAndTransactions.ts | 9 ++++++++- src/lib/crypto/TransferDispatcher.ts | 10 +--------- src/localization/locales/English.json | 15 ++------------ src/localization/locales/Turkish.json | 22 +++++---------------- src/screens/Settings/Settings.tsx | 2 +- 6 files changed, 26 insertions(+), 45 deletions(-) diff --git a/src/components/modular/TokenLogo/index.tsx b/src/components/modular/TokenLogo/index.tsx index f5edabce..925fd0e2 100644 --- a/src/components/modular/TokenLogo/index.tsx +++ b/src/components/modular/TokenLogo/index.tsx @@ -30,26 +30,31 @@ export const TokenLogo = (props: TokenLogoProps) => { return ; } return ; - case AirDAODictTypes.Code.ETH: + case AirDAODictTypes.Code.ETH.toLowerCase(): case 'ethereum': return ; - case AirDAODictTypes.Code.BUSD: + case AirDAODictTypes.Code.BUSD.toLowerCase(): case 'busd token': return ; - case AirDAODictTypes.Code.USDC: + case AirDAODictTypes.Code.USDC.toLowerCase(): case 'usd coin': return ; - case AirDAODictTypes.Code.Tether: + case AirDAODictTypes.Code.Tether.toLowerCase(): case 'tether usd': return ; + case AirDAODictTypes.Code.GanymedePoolToken.toLowerCase(): case 'ganymede pool token': return ; + case AirDAODictTypes.Code.PlutusPoolToken.toLowerCase(): case 'plutus pool token': return ; + case AirDAODictTypes.Code.HeraPoolToken.toLowerCase(): case 'hera pool token': return ; + case AirDAODictTypes.Code.FirepotLp.toLowerCase(): case 'firepot-lp-token': return ; + case AirDAODictTypes.Code.Bond.toLowerCase(): case 'airbond': return ; default: diff --git a/src/hooks/query/useTokensAndTransactions.ts b/src/hooks/query/useTokensAndTransactions.ts index 707bbff3..a5bd2ada 100644 --- a/src/hooks/query/useTokensAndTransactions.ts +++ b/src/hooks/query/useTokensAndTransactions.ts @@ -62,13 +62,20 @@ export function useTokensAndTransactions( return false; }); + const txMap = new Map(); const transactions = data && data.pages ? (data.pages .map((page) => page.data.transactions.map((t) => { const transaction = new Transaction(t); - transaction.isSent = t.from === address; + /** + * When user sends from account to the same account we receive 2 transactions with the same transaction hash. + * */ + const isTransactionDuplicate = txMap.get(transaction.hash); + transaction.isSent = + t.from === address && !isTransactionDuplicate; + txMap.set(transaction.hash, true); return transaction; }) ) diff --git a/src/lib/crypto/TransferDispatcher.ts b/src/lib/crypto/TransferDispatcher.ts index 1ecf9500..518355f7 100644 --- a/src/lib/crypto/TransferDispatcher.ts +++ b/src/lib/crypto/TransferDispatcher.ts @@ -123,15 +123,7 @@ class TransferDispatcher { ) { // @ts-ignore const tokenContract = new this.web3.eth.Contract(erc20.ERC20, tokenAddress); - let decimals = 18; - try { - decimals = await tokenContract.methods.decimals().call(); - } catch (error) { - // ignore - } - const amountInBaseUnits = this.web3.utils - .toBN(parseFloat(amountInEther) * Math.pow(10, decimals)) - .toString(); + const amountInBaseUnits = this.web3.utils.toWei(amountInEther); return { to: tokenAddress, data: tokenContract.methods diff --git a/src/localization/locales/English.json b/src/localization/locales/English.json index 8929f365..7a667963 100644 --- a/src/localization/locales/English.json +++ b/src/localization/locales/English.json @@ -162,22 +162,11 @@ "asset.your.balance": "Your balance", "transaction.modal": { - "amount": "Amount", "buttons": { "explorer": "View on Explorer", - "share": "Share", - "confirm": "Ok, got it" + "share": "Share" }, - "completed": "Completed", - "date": "Date", - "estimated.fee": "Estimated fee", - "from": "From", - "recipient": "Recipient", - "sending": "Transaction in progress", - "sending.to": "Sending to", - "sent": "Sent", - "status": "Status", - "title": "You will receive a notification when the transaction is complete" + "estimated.fee": "Estimated fee" }, "receive.funds": "Receive funds", diff --git a/src/localization/locales/Turkish.json b/src/localization/locales/Turkish.json index 44cd0f8c..8eaa8a88 100644 --- a/src/localization/locales/Turkish.json +++ b/src/localization/locales/Turkish.json @@ -96,7 +96,7 @@ "common.address.with.count": "{{count}} adres", "common.address.with.count_plural": "{{count}} adres", "common.copied": "Kopyalandı!", - "common.copy": "Panoya kopyalandı", + "common.copy": "Panoya kopyala", "common.date": "Tarih", "common.done": "Tamamlandı", "common.field.required": "Zorunlu alan", @@ -115,11 +115,11 @@ "common.transaction": "İşlem", "common.transaction.amount": "Miktar", "common.transaction.details": "İşlem detayları", - "common.transaction.from": "Buradan", + "common.transaction.from": "Gönderen", "common.transaction.received": "Alındı", "common.transaction.sent": "Gönderildi", "common.transaction.status.SUCCESS": "Tamamlandı", - "common.transaction.to": "Buraya", + "common.transaction.to": "Alan", "common.transaction_plural": "İşlem", "common.transactions": "İşlemler", "common.yesterday": "Dün", @@ -162,22 +162,10 @@ "asset.your.balance": "Bakiyeniz", "transaction.modal": { - "amount": "Miktar", "buttons": { "explorer": "Gezginde görüntüle", - "share": "Paylaş", - "confirm": "Anladım" - }, - "completed": "Tamamlandı", - "date": "Tarih", - "estimated.fee": "Tahmini ücret", - "from": "Kimden", - "recipient": "Kime", - "sending": "İşlem devam ediyor", - "sending.to": "Gönderiliyor", - "sent": "Gönderildi", - "status": "Durum", - "title": "İşleminiz gerçekleştiğinde bildirim alacaksınız" + "share": "Paylaş" + } }, "receive.funds": "Varlık al", diff --git a/src/screens/Settings/Settings.tsx b/src/screens/Settings/Settings.tsx index 2cd37915..4fef0d7a 100644 --- a/src/screens/Settings/Settings.tsx +++ b/src/screens/Settings/Settings.tsx @@ -78,7 +78,7 @@ export const SettingsScreen = () => { {SETTINGS_MENU_ITEMS.map(renderMenu)} - {isStage && Build: 1.1.5.19} + {isStage && Build: 1.1.5.20} ); };