diff --git a/.env b/.env
index fe04ac51..d0176dbc 100644
--- a/.env
+++ b/.env
@@ -5,4 +5,4 @@ GENERATE_SOURCEMAP=false
MAINNET_ELECTRUM_SERVERS='https://blockstream.info/api'
TESTNET_ELECTRUM_SERVERS='http://51.158.172.176:3001, https://blockstream.info/testnet/api'
TESTNET_MINTLAYER_SERVERS='https://api-server-lovelace.mintlayer.org'
-MAINNET_MINTLAYER_SERVERS=''
+MAINNET_MINTLAYER_SERVERS='https://api-server.mintlayer.org'
diff --git a/.env.production b/.env.production
index e91bbd28..7623c869 100644
--- a/.env.production
+++ b/.env.production
@@ -5,4 +5,4 @@ GENERATE_SOURCEMAP=false
MAINNET_ELECTRUM_SERVERS='https://blockstream.info/api'
TESTNET_ELECTRUM_SERVERS='http://51.158.172.176:3001, https://blockstream.info/testnet/api'
TESTNET_MINTLAYER_SERVERS='https://api-server-lovelace.mintlayer.org'
-MAINNET_MINTLAYER_SERVERS=''
\ No newline at end of file
+MAINNET_MINTLAYER_SERVERS='https://api-server.mintlayer.org'
\ No newline at end of file
diff --git a/.env.staging b/.env.staging
index 0d01955e..2d039584 100644
--- a/.env.staging
+++ b/.env.staging
@@ -5,4 +5,4 @@ GENERATE_SOURCEMAP=true
MAINNET_ELECTRUM_SERVERS='https://blockstream.info/api'
TESTNET_ELECTRUM_SERVERS='http://51.158.172.176:3001, https://blockstream.info/testnet/api'
TESTNET_MINTLAYER_SERVERS='https://api-server-lovelace.mintlayer.org'
-MAINNET_MINTLAYER_SERVERS=''
+MAINNET_MINTLAYER_SERVERS='https://api-server.mintlayer.org'
diff --git a/src/components/containers/Dashboard/CryptoList.js b/src/components/containers/Dashboard/CryptoList.js
index e95a32e6..d8f4d225 100644
--- a/src/components/containers/Dashboard/CryptoList.js
+++ b/src/components/containers/Dashboard/CryptoList.js
@@ -8,28 +8,28 @@ import { SettingsContext, AccountContext } from '@Contexts'
import './CryptoList.css'
//TODO: remove this when mainnet is ready
-const MainnetAddressItem = () => {
- const { setOpenShowAddressTemp } = useContext(AccountContext)
- const onItemClick = () => {
- setOpenShowAddressTemp(true)
- }
- return (
-
-
-
-
-
-
Mintlayer (ML)
-
- Click here to get your Mainnet address
-
-
-
- )
-}
+// const MainnetAddressItem = () => {
+// const { setOpenShowAddressTemp } = useContext(AccountContext)
+// const onItemClick = () => {
+// setOpenShowAddressTemp(true)
+// }
+// return (
+//
+//
+//
+//
+//
+//
Mintlayer (ML)
+//
+// Click here to get your Mainnet address
+//
+//
+//
+// )
+// }
export const CryptoItem = ({ colorList, onClickItem, item }) => {
const { balanceLoading } = useContext(AccountContext)
@@ -55,61 +55,54 @@ export const CryptoItem = ({ colorList, onClickItem, item }) => {
{balanceLoading ? (
) : (
- <>
- {/* TODO: remove this when mainnet is ready */}
- {item.name === 'Mintlayer' && !isTestnet ? (
-
- ) : (
-
- {item.name === 'Mintlayer' ? : }
-
-
- {item.name} ({symbol})
-
-
-
- - Value:
- - {balance}
- {!isTestnet && (
- <>
- - Price:
- - {item.exchangeRate.toFixed(2)}
- >
- )}
-
-
-
-
-
- {Number(balance) > 0 && (
- <>
-
- {isTestnet ? 0 : item.change24h}%
-
- 24h
- >
- )}
-
+
+ {item.name === 'Mintlayer' ? : }
+
+
+ {item.name} ({symbol})
+
+
+
+ - Value:
+ - {balance}
{!isTestnet && (
-
+ <>
+ - Price:
+ - {item.exchangeRate.toFixed(2)}
+ >
)}
-
-
- )}
- >
+
+
+
+
+
+ {Number(balance) > 0 && (
+ <>
+
+ {isTestnet ? 0 : item.change24h}%
+
+ 24h
+ >
+ )}
+
+ {(!isTestnet || !data.length) && (
+
+ )}
+
+
)}
>
)
diff --git a/src/components/containers/Wallet/TransactionDetails.js b/src/components/containers/Wallet/TransactionDetails.js
index 74184e7e..81996800 100644
--- a/src/components/containers/Wallet/TransactionDetails.js
+++ b/src/components/containers/Wallet/TransactionDetails.js
@@ -43,9 +43,9 @@ const TransactionDetails = ({ transaction, getConfirmations }) => {
isTestnet ? '/testnet' : ''
}/tx/${transaction?.txid}`
- const externalMlLink = `https://explorer.mintlayer.org${
- isTestnet ? '/lovelace' : ''
- }/tx/${transaction?.txid}`
+ const externalMlLink = `https://${
+ isTestnet ? 'lovelace.' : ''
+ }explorer.mintlayer.org/tx/${transaction?.txid}`
const explorerLink =
walletType.name === 'Mintlayer' ? externalMlLink : externalBtcLink
diff --git a/src/contexts/AccountProvider/AccountProvider.js b/src/contexts/AccountProvider/AccountProvider.js
index 2132efbb..c49ab005 100644
--- a/src/contexts/AccountProvider/AccountProvider.js
+++ b/src/contexts/AccountProvider/AccountProvider.js
@@ -15,9 +15,6 @@ const AccountProvider = ({ value: propValue, children }) => {
const [transactionsLoading, setTransactionsLoading] = useState(false)
const [feeLoading, setFeeLoading] = useState(false)
- //TODO: remove this after mainnet launch
- const [openShowAddressTemp, setOpenShowAddressTemp] = useState(false)
-
const accountRegistryName = 'unlockedAccount'
const loginTimeoutInMinutes = 30
@@ -96,8 +93,6 @@ const AccountProvider = ({ value: propValue, children }) => {
setTransactionsLoading,
feeLoading,
setFeeLoading,
- openShowAddressTemp,
- setOpenShowAddressTemp,
}
useEffect(() => {
diff --git a/src/hooks/UseExchangeRates/useExchangeRates.js b/src/hooks/UseExchangeRates/useExchangeRates.js
index d25894b5..3339eb12 100644
--- a/src/hooks/UseExchangeRates/useExchangeRates.js
+++ b/src/hooks/UseExchangeRates/useExchangeRates.js
@@ -2,20 +2,12 @@ import { useEffect, useState, useRef, useCallback } from 'react'
import { ExchangeRates } from '@APIs'
-// TODO: Remove this mock
-const ML_EXCHANGE_RATE_MOCK = 0.055
-
const useExchangeRates = (crypto, fiat) => {
const effectCalled = useRef(false)
const [exchangeRate, setExchangeRate] = useState(0)
const getRate = useCallback(async () => {
try {
- // TODO: Remove this mock
- if (crypto === 'ML' || crypto === 'ml') {
- setExchangeRate(ML_EXCHANGE_RATE_MOCK)
- return
- }
const response = await ExchangeRates.getRate(crypto, fiat)
const rates = JSON.parse(response)[`${crypto}-${fiat}`]
setExchangeRate(rates)
diff --git a/src/hooks/UseOneDayAgoExchangeRates/useOneDayAgoExchangeRates.js b/src/hooks/UseOneDayAgoExchangeRates/useOneDayAgoExchangeRates.js
index a807cae3..d7239395 100644
--- a/src/hooks/UseOneDayAgoExchangeRates/useOneDayAgoExchangeRates.js
+++ b/src/hooks/UseOneDayAgoExchangeRates/useOneDayAgoExchangeRates.js
@@ -2,20 +2,12 @@ import { useEffect, useState, useRef, useCallback } from 'react'
import { ExchangeRates } from '@APIs'
-// TODO: Remove this mock
-const ML_YESTERDAY_EXCHANGE_RATE_MOCK = 0.055
-
const useOneDayAgoExchangeRates = (crypto, fiat) => {
const effectCalled = useRef(false)
const [yesterdayExchangeRate, setYesterdayExchangeRate] = useState(0)
const getRate = useCallback(async () => {
try {
- // TODO: Remove this mock
- if (crypto === 'ML' || crypto === 'ml') {
- setYesterdayExchangeRate(ML_YESTERDAY_EXCHANGE_RATE_MOCK)
- return
- }
const response = await ExchangeRates.getOneDayAgoRate(crypto, fiat)
const rates = JSON.parse(response)[`${crypto}-${fiat}`]
setYesterdayExchangeRate(rates)
diff --git a/src/pages/Dashboard/Dashboard.js b/src/pages/Dashboard/Dashboard.js
index 5bb27ca9..b749e10e 100644
--- a/src/pages/Dashboard/Dashboard.js
+++ b/src/pages/Dashboard/Dashboard.js
@@ -1,8 +1,8 @@
+/* eslint-disable max-params */
import { useContext, useState, useEffect } from 'react'
import { Header, PopUp, AddWallet } from '@ComposedComponents'
import { AccountContext, SettingsContext } from '@Contexts'
import { Account } from '@Entities'
-import { Wallet } from '@ContainerComponents'
import {
useExchangeRates,
@@ -20,14 +20,8 @@ import { BTC } from '@Helpers'
import { AppInfo } from '@Constants'
const DashboardPage = () => {
- const {
- addresses,
- accountName,
- setWalletType,
- accountID,
- openShowAddressTemp,
- setOpenShowAddressTemp,
- } = useContext(AccountContext)
+ const { addresses, accountName, setWalletType, accountID } =
+ useContext(AccountContext)
const { networkType } = useContext(SettingsContext)
const currentBtcAddress =
networkType === AppInfo.NETWORK_TYPES.MAINNET
@@ -50,7 +44,8 @@ const DashboardPage = () => {
useOneDayAgoExchangeRates('btc', 'usd')
const { yesterdayExchangeRate: mlYesterdayExchangeRate } =
useOneDayAgoExchangeRates('ml', 'usd')
- const { historyRates } = useOneDayAgoHist('btc', 'usd')
+ const { historyRates: btcHistoryRates } = useOneDayAgoHist('btc', 'usd')
+ const { historyRates: mlHistoryrates } = useOneDayAgoHist('ml', 'usd')
const navigate = useNavigate()
const yesterdayExchangeRateList = {
@@ -82,7 +77,7 @@ const DashboardPage = () => {
{
name: 'Bitcoin',
symbol: 'BTC',
- balance: NumbersHelper.floatStringToNumber(btcBalance),
+ balance: 0,
exchangeRate: btcExchangeRate,
},
{
@@ -101,15 +96,21 @@ const DashboardPage = () => {
const getCryptoList = (addresses, network) => {
if (!addresses) return []
const cryptos = []
- // eslint-disable-next-line max-params
- const addCrypto = (name, symbol, balance, exchangeRate, change24h) => {
+ const addCrypto = (
+ name,
+ symbol,
+ balance,
+ exchangeRate,
+ change24h,
+ historyRates,
+ ) => {
cryptos.push({
name,
symbol,
balance: NumbersHelper.floatStringToNumber(balance),
exchangeRate,
- historyRates,
change24h,
+ historyRates,
})
}
@@ -121,13 +122,31 @@ const DashboardPage = () => {
network === AppInfo.NETWORK_TYPES.MAINNET
? Number((proportionDiffs.btc - 1) * 100).toFixed(2)
: 0
- addCrypto('Bitcoin', 'BTC', btcBalance, btcExchangeRate, change24h)
+ addCrypto(
+ 'Bitcoin',
+ 'BTC',
+ btcBalance,
+ btcExchangeRate,
+ change24h,
+ btcHistoryRates,
+ )
}
const mlAddress = addresses.mlMainnetAddress
? addresses.mlTestnetAddresses.mlReceivingAddresses[0]
: false
if (mlAddress) {
- addCrypto('Mintlayer', 'ML', mlBalance, mlExchangeRate, 0)
+ const change24h =
+ network === AppInfo.NETWORK_TYPES.MAINNET
+ ? Number((proportionDiffs.ml - 1) * 100).toFixed(2)
+ : 0
+ addCrypto(
+ 'Mintlayer',
+ 'ML',
+ mlBalance,
+ mlExchangeRate,
+ change24h,
+ mlHistoryrates,
+ )
}
return cryptos
@@ -191,15 +210,6 @@ const DashboardPage = () => {
/>
)}
-
- {/* //TODO: remove this after mainnet launch */}
- {openShowAddressTemp && (
-
-
-
- )}
>
)
}
diff --git a/src/pages/Wallet/Wallet.js b/src/pages/Wallet/Wallet.js
index 664da9a9..0eacad7b 100644
--- a/src/pages/Wallet/Wallet.js
+++ b/src/pages/Wallet/Wallet.js
@@ -1,5 +1,5 @@
import React, { useNavigate } from 'react-router-dom'
-import { useContext } from 'react'
+import { useContext, useState } from 'react'
import { Balance, Header, PopUp } from '@ComposedComponents'
import { VerticalGroup } from '@LayoutComponents'
@@ -15,8 +15,7 @@ import './Wallet.css'
const WalletPage = () => {
const navigate = useNavigate()
- const { addresses, walletType, openShowAddressTemp, setOpenShowAddressTemp } =
- useContext(AccountContext)
+ const { addresses, walletType } = useContext(AccountContext)
const { networkType } = useContext(SettingsContext)
const btcAddress =
networkType === AppInfo.NETWORK_TYPES.MAINNET
@@ -26,8 +25,7 @@ const WalletPage = () => {
networkType === AppInfo.NETWORK_TYPES.MAINNET
? addresses.mlMainnetAddress
: addresses.mlTestnetAddresses
- // TODO: revert this after mainnet launch
- // const [openShowAddress, setOpenShowAddress] = useState(false)
+ const [openShowAddress, setOpenShowAddress] = useState(false)
const { btcTransactionsList, btcBalance } = useBtcWalletInfo(btcAddress)
const { mlTransactionsList, mlBalance } = useMlWalletInfo(currentMlAddresses)
const { exchangeRate: btcExchangeRate } = useExchangeRates('btc', 'usd')
@@ -48,7 +46,7 @@ const WalletPage = () => {
const account = LocalStorageService.getItem('unlockedAccount')
const accountName = account.name
- const unconfirmedTransactionString = `${AppInfo.UNCONFIRMED_TRANSACTION_NAME}_${accountName}`
+ const unconfirmedTransactionString = `${AppInfo.UNCONFIRMED_TRANSACTION_NAME}_${accountName}_${networkType}`
const isUncofermedTransaction =
LocalStorageService.getItem(unconfirmedTransactionString) &&
walletType.name === 'Mintlayer'
@@ -71,11 +69,10 @@ const WalletPage = () => {
/>
setOpenShowAddressTemp(true)}
+ onClick={() => setOpenShowAddress(true)}
/>
- {/* TODO: revert this after mainnet launch */}
- {openShowAddressTemp && (
-
+ {openShowAddress && (
+
diff --git a/src/services/Crypto/Mintlayer/Mintlayer.js b/src/services/Crypto/Mintlayer/Mintlayer.js
index 357fd62b..a60b31b8 100644
--- a/src/services/Crypto/Mintlayer/Mintlayer.js
+++ b/src/services/Crypto/Mintlayer/Mintlayer.js
@@ -150,8 +150,10 @@ export const getUnusedAddress = async (addresses) => {
if (!isUsed) {
return addresses[i]
}
+ if (i === addresses.length - 1) {
+ return addresses[i]
+ }
}
- return null
}
export const getEncodedOutpointSourceId = async (txId) => {
diff --git a/src/utils/Helpers/ML/ML.js b/src/utils/Helpers/ML/ML.js
index ea94ac0a..5ccd2a55 100644
--- a/src/utils/Helpers/ML/ML.js
+++ b/src/utils/Helpers/ML/ML.js
@@ -12,8 +12,9 @@ const getAmountInAtoms = (amountInCoins) => {
const getParsedTransactions = (transactions, addresses) => {
const account = LocalStorageService.getItem('unlockedAccount')
+ const networkType = LocalStorageService.getItem('networkType')
const accountName = account.name
- const unconfirmedTransactionString = `${AppInfo.UNCONFIRMED_TRANSACTION_NAME}_${accountName}`
+ const unconfirmedTransactionString = `${AppInfo.UNCONFIRMED_TRANSACTION_NAME}_${accountName}_${networkType}`
const unconfirmedTransactions = LocalStorageService.getItem(
unconfirmedTransactionString,
)
diff --git a/src/utils/Helpers/ML/MLTransaction.js b/src/utils/Helpers/ML/MLTransaction.js
index b5f65fb4..bbbcead5 100644
--- a/src/utils/Helpers/ML/MLTransaction.js
+++ b/src/utils/Helpers/ML/MLTransaction.js
@@ -256,7 +256,7 @@ const sendTransaction = async (
const account = LocalStorageService.getItem('unlockedAccount')
const accountName = account.name
- const unconfirmedTransactionString = `${AppInfo.UNCONFIRMED_TRANSACTION_NAME}_${accountName}`
+ const unconfirmedTransactionString = `${AppInfo.UNCONFIRMED_TRANSACTION_NAME}_${accountName}_${network}`
const unconfirmedTransactions = LocalStorageService.getItem(
unconfirmedTransactionString,
)