diff --git a/src/pages/Settings/Contracts.tsx b/src/pages/Settings/Contracts.tsx
index 4e75fd4f..6a72d7ac 100644
--- a/src/pages/Settings/Contracts.tsx
+++ b/src/pages/Settings/Contracts.tsx
@@ -1,3 +1,4 @@
+// @ts-nocheck
import React, { useState, useEffect, useCallback, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import styled from 'styled-components'
@@ -316,11 +317,15 @@ export default function Contracts() {
const [routerChainId, setRouterChainId] = useState('')
const [routerAddress, setRouterAddress] = useState('')
+ const [routerConfirmCount, setRouterConfirmCount] = useState(3)
useEffect(() => {
if (chainId !== undefined && stateRouterAddress[chainId]) {
setRouterChainId(String(chainId))
setRouterAddress(stateRouterAddress[chainId])
+ if (stateAppSettings?.routerConfigs[`${chainId}:${stateRouterAddress[chainId]}`]) {
+ setRouterConfirmCount(stateAppSettings.routerConfigs[`${chainId}:${stateRouterAddress[chainId]}`].confirmations)
+ }
} else {
setRouterChainId('')
setRouterAddress('')
@@ -354,14 +359,14 @@ export default function Contracts() {
const tx = await routerConfigSigner.setChainConfig(routerChainId, {
BlockChain: name,
RouterContract: routerAddress,
- Confirmations: 3,
+ Confirmations: routerConfirmCount,
InitialHeight: 0
})
const receipt = await tx.wait()
if (receipt.status) {
- dispatch(updateRouterData({ chainId: Number(routerChainId), routerAddress: routerAddress }))
+ dispatch(updateRouterData({ chainId: Number(routerChainId), routerAddress: routerAddress, routerConfirmCount: routerConfirmCount }))
addTransaction(
{ hash: receipt.transactionHash },
{
@@ -476,13 +481,16 @@ export default function Contracts() {
if (selectedContract !== `-`) {
const {
chainId,
- address
+ address,
+ confirmations
} = appSettings.routerConfigs[selectedContract]
setRouterChainId(`${chainId}`)
setRouterAddress(address)
+ setRouterConfirmCount(confirmations)
} else {
setRouterChainId(``)
setRouterAddress(``)
+ setRouterConfirmCount(3)
}
}
@@ -771,6 +779,12 @@ export default function Contracts() {
value={routerAddress}
onChange={event => setRouterAddress(event.target.value)}
/>
+ {t('routerConfirmCount')}
+ setRouterConfirmCount(event.target.value)}
+ />
{onConfigNetwork ? (
diff --git a/src/pages/Settings/FetchMainConfig.tsx b/src/pages/Settings/FetchMainConfig.tsx
index fe450c35..3359eefa 100644
--- a/src/pages/Settings/FetchMainConfig.tsx
+++ b/src/pages/Settings/FetchMainConfig.tsx
@@ -1,3 +1,4 @@
+// @ts-nocheck
import React, { useState, useEffect, useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { ERC20_ABI } from '../../constants/abis/erc20'
@@ -105,6 +106,7 @@ export default function FetchMainConfig({
// @ts-ignore
const crosschainTokens: any = {}
const chainRouters: any = {}
+ const chainRoutersConfirmsCount: any = {}
useMulticall(mainConfigChainId, multicallDataTokenConfigs)
.then((contractTokenConfigs) => {
@@ -117,6 +119,7 @@ export default function FetchMainConfig({
switch (method) {
case `getChainConfig`:
chainRouters[callData.tokenChainId] = aData.RouterContract
+ chainRoutersConfirmsCount[callData.tokenChainId] = aData.Confirmations.toNumber()
break;
case `getTokenConfig`:
const {
@@ -262,7 +265,8 @@ export default function FetchMainConfig({
const chainRouterAddress = chainRouters[chainId]
updatedRouterConfigs[`${chainId}:${chainRouterAddress}`] = {
address: chainRouterAddress,
- chainId
+ chainId,
+ confirmations: chainRoutersConfirmsCount[chainId]
}
})
diff --git a/src/state/application/actions.ts b/src/state/application/actions.ts
index 97963436..b424e2bd 100644
--- a/src/state/application/actions.ts
+++ b/src/state/application/actions.ts
@@ -101,7 +101,7 @@ export type AppData = {
export type AppDataKeys = keyof AppData
-export const updateRouterData = createAction<{ chainId: number; routerAddress: string }>('application/updateRouterData')
+export const updateRouterData = createAction<{ chainId: number; routerAddress: string, routerConfirmCount: number }>('application/updateRouterData')
export const setAppManagement = createAction<{ status: boolean }>('application/setAppManagement')
export const retrieveAppData = createAction('application/retrieveAppData')
export const updateAppOptions = createAction<{ key: AppDataKeys; value: AppData[AppDataKeys] }[]>(
diff --git a/src/state/application/updater.ts b/src/state/application/updater.ts
index 3b7351fa..890a26a1 100644
--- a/src/state/application/updater.ts
+++ b/src/state/application/updater.ts
@@ -43,15 +43,16 @@ export default function Updater(): null {
const fetch = async () => {
if (!routerConfig || !chainId) return
- const { RouterContract } = await routerConfig.methods.getChainConfig(chainId).call()
+ const routerData = await routerConfig.methods.getChainConfig(chainId).call()
+ const { RouterContract } = routerData
- dispatch(updateRouterData({ chainId, routerAddress: RouterContract === ZERO_ADDRESS ? '' : RouterContract }))
+ dispatch(updateRouterData({ chainId, routerAddress: RouterContract === ZERO_ADDRESS ? '' : RouterContract, routerConfirmCount: 3 }))
}
if (routerConfig && chainId) {
fetch()
} else {
- dispatch(updateRouterData({ chainId: chainId || 0, routerAddress: '' }))
+ dispatch(updateRouterData({ chainId: chainId || 0, routerAddress: '', routerConfirmCount: 3 }))
}
}, [chainId, mainConfigAddress, mainConfigChainId, routerConfig])
diff --git a/tsconfig.json b/tsconfig.json
index bd37dd90..21b779c5 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -11,7 +11,7 @@
"strict": false,
"alwaysStrict": false,
"strictNullChecks": true,
- "noUnusedLocals": true,
+ "noUnusedLocals": false,
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitThis": true,