diff --git a/cypress/e2e/helpers/base/base.ts b/cypress/e2e/helpers/base/base.ts
index fa15b13f..4f185f07 100644
--- a/cypress/e2e/helpers/base/base.ts
+++ b/cypress/e2e/helpers/base/base.ts
@@ -1,19 +1,11 @@
-import {
- Avalanche,
- AvalancheTestnet,
- Binance,
- BinanceTestnet,
-} from './constants'
+import { Binance, BinanceTestnet } from './constants'
import { MetamaskNetwork } from './types'
export default class Base {
addSupportedNetwork() {
// Mainnet
this.addNetwork(Binance)
- this.addNetwork(Avalanche)
- // Avax
this.addNetwork(BinanceTestnet)
- this.addNetwork(AvalancheTestnet)
}
visit() {
diff --git a/cypress/e2e/helpers/base/constants.ts b/cypress/e2e/helpers/base/constants.ts
index de3a3e66..5cb3a866 100644
--- a/cypress/e2e/helpers/base/constants.ts
+++ b/cypress/e2e/helpers/base/constants.ts
@@ -9,15 +9,6 @@ export const Binance: MetamaskNetwork = {
isTestnet: false,
}
-export const Avalanche: MetamaskNetwork = {
- networkName: 'Avalanche Mainnet',
- rpcUrl: 'https://api.avax.network/ext/bc/C/rpc',
- chainId: '43114',
- symbol: 'AVAX',
- blockExplorer: 'https://snowtrace.io/',
- isTestnet: false,
-}
-
export const BinanceTestnet: MetamaskNetwork = {
networkName: 'BNB Testnet',
rpcUrl: 'https://data-seed-prebsc-1-s1.binance.org:8545',
@@ -27,14 +18,6 @@ export const BinanceTestnet: MetamaskNetwork = {
isTestnet: true,
}
-export const AvalancheTestnet: MetamaskNetwork = {
- networkName: 'Avalanche Testnet',
- rpcUrl: 'https://api.avax-test.network/ext/bc/C/rpc',
- chainId: '43113',
- symbol: 'AVAX',
- blockExplorer: 'https://testnet.snowtrace.io/',
- isTestnet: true,
-}
export const EthereumInfo: NetworkTestInfo = {
networkName: 'Ethereum',
networkAbbreviation: 'ETHEREUM',
@@ -46,17 +29,7 @@ export const BinanceInfo: NetworkTestInfo = {
isTestnet: false,
}
-export const AvalancheInfo: NetworkTestInfo = {
- networkName: 'Avalanche Mainnet C-Chain',
- networkAbbreviation: 'AVAX',
- isTestnet: false,
-}
-
-export const MainnetL1Networks: NetworkTestInfo[] = [
- EthereumInfo,
- BinanceInfo,
- AvalancheInfo,
-]
+export const MainnetL1Networks: NetworkTestInfo[] = [EthereumInfo, BinanceInfo]
export const MainnetL2Networks: NetworkTestInfo[] = [
{
@@ -69,11 +42,6 @@ export const MainnetL2Networks: NetworkTestInfo[] = [
networkAbbreviation: 'Boba BNB',
isTestnet: false,
},
- {
- networkName: 'Boba Avalanche',
- networkAbbreviation: 'Boba Avalanche',
- isTestnet: false,
- },
]
export const EthereumGoerliInfo: NetworkTestInfo = {
@@ -89,11 +57,6 @@ export const TestnetL1Networks: NetworkTestInfo[] = [
networkAbbreviation: 'BNB',
isTestnet: true,
},
- {
- networkName: 'Fuji Testnet',
- networkAbbreviation: 'AVAX',
- isTestnet: true,
- },
]
export const TestnetL2Networks: NetworkTestInfo[] = [
@@ -107,9 +70,4 @@ export const TestnetL2Networks: NetworkTestInfo[] = [
networkAbbreviation: 'Boba BNB',
isTestnet: true,
},
- {
- networkName: 'Boba Fuji Testnet',
- networkAbbreviation: 'Boba Fuji',
- isTestnet: true,
- },
]
diff --git a/cypress/e2e/helpers/base/page.ts b/cypress/e2e/helpers/base/page.ts
index c3da66ad..44b10bfa 100644
--- a/cypress/e2e/helpers/base/page.ts
+++ b/cypress/e2e/helpers/base/page.ts
@@ -61,7 +61,7 @@ export default class Page extends Base {
cy.get('body').find('wcm-modal').should('exist')
}
- setNetworkTo(network: 'BNB' | 'AVAX' | 'ETH', type = 'Mainnet') {
+ setNetworkTo(network: 'BNB' | 'ETH', type = 'Mainnet') {
const bnbConfig = {
network: 'BNB',
name: {
@@ -73,17 +73,6 @@ export default class Page extends Base {
networkType: type,
}
- const avaxConfig = {
- network: 'AVAX',
- name: {
- l1: 'Avalanche Mainnet C-Chain',
- l2: 'Boba Avalanche',
- },
- networkIcon: 'avax',
- chainIds: { L1: '43114', L2: '43288' },
- networkType: type,
- }
-
const ethConfig = {
network: 'ETHEREUM',
name: {
@@ -98,8 +87,6 @@ export default class Page extends Base {
let payload = ethConfig
if (network === 'BNB') {
payload = bnbConfig
- } else if (network === 'AVAX') {
- payload = avaxConfig
}
cy.window().its('store').invoke('dispatch', {
@@ -151,31 +138,6 @@ export default class Page extends Base {
})
}
- checkNaviagtionListAvalanche() {
- this.header
- .getNavigationLinks()
- .should('not.be.empty')
- .and(($p) => {
- // should have found 3 elements for Avalanche
- expect($p).to.have.length(3)
-
- // // use jquery's map to grab all of their classes
- // // jquery's map returns a new jquery object
- const links = $p.map((i, el) => {
- return Cypress.$(el).attr('href')
- })
- // call classes.get() to make this a plain array
- expect(links.get()).to.deep.eq(['/bridge', '/bridge', '/history'])
-
- // get labels and verify
- const labels = $p.map((i, el) => {
- return Cypress.$(el).text()
- })
-
- expect(labels.get()).to.deep.eq(['', 'Bridge', 'History'])
- })
- }
-
checkNavigationListEthereum() {
this.header
.getNavigationLinks()
@@ -235,7 +197,6 @@ export default class Page extends Base {
.click()
.should('have.text', 'Ethereum (Goerli)')
.should('have.text', 'BNB Testnet')
- .should('have.text', 'Fuji Testnet')
}
// check theme switching functionality
@@ -279,12 +240,6 @@ export default class Page extends Base {
this.allowNetworkSwitch()
this.checkNetworkSwitchSuccessful('BNB')
- // switch to AVAX
- this.header.switchNetwork('Avalanche Mainnet')
- this.handleNetworkSwitchModals('AVAX', false)
- this.allowNetworkSwitch()
- this.checkNetworkSwitchSuccessful('AVAX')
-
// switch to Ethereum
this.header.switchNetwork('Ethereum')
this.handleNetworkSwitchModals('ETHEREUM', false)
diff --git a/cypress/e2e/helpers/bridge.ts b/cypress/e2e/helpers/bridge.ts
index d5ac4cc3..b78c54db 100644
--- a/cypress/e2e/helpers/bridge.ts
+++ b/cypress/e2e/helpers/bridge.ts
@@ -191,11 +191,11 @@ export default class Bridge extends Page {
l2Networks: NetworkTestInfo[],
accountConnected: boolean
) {
- for (let i = 0; i < 3; i++) {
+ for (let i = 0; i < 2; i++) {
this.withinPage().contains(l2Networks[i].networkName).should('exist')
this.openNetworkModal(l1Networks[i].networkName)
- const nextNetwork = l1Networks[(i + 1) % 3]
+ const nextNetwork = l1Networks[(i + 1) % 2]
this.selectNetworkFromModal(nextNetwork.networkName)
if (accountConnected) {
this.handleNetworkSwitchModals(
diff --git a/cypress/e2e/specs/layout.spec.cy.ts b/cypress/e2e/specs/layout.spec.cy.ts
index 290cb70b..7fc8a4b1 100644
--- a/cypress/e2e/specs/layout.spec.cy.ts
+++ b/cypress/e2e/specs/layout.spec.cy.ts
@@ -13,8 +13,6 @@ describe('Page Layout', () => {
page.checkNavigationListEthereum()
page.setNetworkTo('BNB')
page.checkNaviagtionListBinanace()
- page.setNetworkTo('AVAX')
- page.checkNaviagtionListAvalanche()
})
it('Theme switcher should work', () => {
diff --git a/src/actions/balanceAction.js b/src/actions/balanceAction.js
deleted file mode 100644
index cd0a0c04..00000000
--- a/src/actions/balanceAction.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- Varna - A Privacy-Preserving Marketplace
- Varna uses Fully Homomorphic Encryption to make markets fair.
- Copyright (C) 2021 Enya Inc. Palo Alto, CA
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-*/
-
-import networkService from 'services/networkService'
-import { createAction } from './createAction'
-
-export function fetchL1LPBalance(address) {
- return createAction('FETCH/L1LP/BALANCE', () => networkService.L1LPBalance(address))
-}
-
-export function fetchL2LPBalance(address) {
- return createAction('FETCH/L2LP/BALANCE', () => networkService.L2LPBalance(address))
-}
-
-export function fetchL1LPPending(address) {
- return createAction('FETCH/L1LP/PENDING', () => networkService.L1LPPending(address))
-}
-
-export function fetchL2LPPending(address) {
- return createAction('FETCH/L2LP/PENDING', () => networkService.L2LPPending(address))
-}
-
-export function fetchL1LPLiquidity(address) {
- return createAction('FETCH/L1LP/LIQUIDITY', () => networkService.L1LPLiquidity(address))
-}
-
-export function fetchL2LPLiquidity(address) {
- return createAction('FETCH/L2LP/LIQUIDITY', () => networkService.L2LPLiquidity(address))
-}
-
-export function fetchL1TotalFeeRate() { return createAction('FETCH/L1TOTALFEERATE', ()=>{return networkService.getL1TotalFeeRate()}) }
-export function fetchL2TotalFeeRate() { return createAction('FETCH/L2TOTALFEERATE', ()=>{return networkService.getL2TotalFeeRate()}) }
-
-export function fetchL1FeeRateN(tokenAddress) { return createAction('FETCH/L1FEERATE', ()=>{return networkService.getL1UserRewardFeeRate(tokenAddress)}) }
-export function fetchL2FeeRateN(tokenAddress) { return createAction('FETCH/L2FEERATE', ()=>{return networkService.getL2UserRewardFeeRate(tokenAddress)}) }
-
-export function fetchFastExitCost(address) {
- return createAction('FETCH/FASTEXIT/COST', () => networkService.getFastExitCost(address))
-}
-
-export function fetchClassicExitCost(address) {
- return createAction('FETCH/CLASSICEXIT/COST', () => networkService.getExitCost(address))
-}
-
-export function fetchFastDepositCost(address) {
- return createAction('FETCH/FASTDEPOSIT/COST', () => networkService.getFastDepositCost(address))
-}
-
-export function fetchAltL1DepositFee() {
- return createAction('FETCH/ALTL1DEPOSIT/COST', () => networkService.getAltL1DepositFee())
-}
-
-export function fetchFastDepositBatchCost(tokenList) {
- return createAction('FETCH/FASTDEPOSIT/BATCH/COST', () => networkService.getFastDepositBatchCost(tokenList))
-}
-
-export function fetchL1FeeBalance() {
- return createAction('FETCH/L1FEE/BALANCE', () => networkService.getL1FeeBalance())
-}
-
-export function fetchL2BalanceETH() {
- return createAction('FETCH/L2ETH/BALANCE', () => networkService.getL2BalanceETH())
-}
-
-export function fetchL2BalanceBOBA() {
- return createAction('FETCH/L2BOBA/BALANCE', () => networkService.getL2BalanceBOBA())
-}
-
-export function fetchUserAndL2LPBalanceBatch(tokenList) {
- return createAction('FETCH/USER/L2LP/BALANCE/BATCH', () => networkService.getL2UserAndLPBalanceBatch(tokenList))
-}
-
-export function fetchExitFee() {
- return createAction('FETCH/EXITFEE', () => networkService.getExitFeeFromBillingContract())
-}
diff --git a/src/actions/balanceAction.ts b/src/actions/balanceAction.ts
new file mode 100644
index 00000000..c305b066
--- /dev/null
+++ b/src/actions/balanceAction.ts
@@ -0,0 +1,90 @@
+/*
+ Varna - A Privacy-Preserving Marketplace
+ Varna uses Fully Homomorphic Encryption to make markets fair.
+ Copyright (C) 2021 Enya Inc. Palo Alto, CA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+import networkService from 'services/networkService'
+import { createAction } from './createAction'
+
+export const fetchL1LPBalance = (address: string) =>
+ createAction('FETCH/L1LP/BALANCE', () => networkService.L1LPBalance(address))
+
+export const fetchL2LPBalance = (address: string) =>
+ createAction('FETCH/L2LP/BALANCE', () => networkService.L2LPBalance(address))
+
+export const fetchL1LPPending = (address: string) =>
+ createAction('FETCH/L1LP/PENDING', () => networkService.L1LPPending(address))
+
+export const fetchL2LPPending = (address: string) =>
+ createAction('FETCH/L2LP/PENDING', () => networkService.L2LPPending(address))
+
+export const fetchL1LPLiquidity = (address: string) =>
+ createAction('FETCH/L1LP/LIQUIDITY', () =>
+ networkService.L1LPLiquidity(address)
+ )
+
+export const fetchL2LPLiquidity = (address: string) =>
+ createAction('FETCH/L2LP/LIQUIDITY', () =>
+ networkService.L2LPLiquidity(address)
+ )
+
+export const fetchL1TotalFeeRate = () =>
+ createAction('FETCH/L1TOTALFEERATE', () => {
+ return networkService.getL1TotalFeeRate()
+ })
+export const fetchL2TotalFeeRate = () =>
+ createAction('FETCH/L2TOTALFEERATE', () => {
+ return networkService.getL2TotalFeeRate()
+ })
+
+export const fetchL1FeeRateN = (tokenAddress: string) =>
+ createAction('FETCH/L1FEERATE', () => {
+ return networkService.getL1UserRewardFeeRate(tokenAddress)
+ })
+export const fetchL2FeeRateN = (tokenAddress: string) =>
+ createAction('FETCH/L2FEERATE', () => {
+ return networkService.getL2UserRewardFeeRate(tokenAddress)
+ })
+
+export const fetchFastExitCost = (address: string) =>
+ createAction('FETCH/FASTEXIT/COST', () =>
+ networkService.getFastExitCost(address)
+ )
+
+export const fetchClassicExitCost = (address: string) =>
+ createAction('FETCH/CLASSICEXIT/COST', () =>
+ networkService.getExitCost(address)
+ )
+
+export const fetchFastDepositCost = (address: string) =>
+ createAction('FETCH/FASTDEPOSIT/COST', () =>
+ networkService.getFastDepositCost(address)
+ )
+
+export const fetchL1FeeBalance = () =>
+ createAction('FETCH/L1FEE/BALANCE', () => networkService.getL1FeeBalance())
+
+export const fetchL2BalanceETH = () =>
+ createAction('FETCH/L2ETH/BALANCE', () => networkService.getL2BalanceETH())
+
+export const fetchL2BalanceBOBA = () =>
+ createAction('FETCH/L2BOBA/BALANCE', () => networkService.getL2BalanceBOBA())
+
+export const fetchExitFee = () =>
+ createAction('FETCH/EXITFEE', () =>
+ networkService.getExitFeeFromBillingContract()
+ )
diff --git a/src/actions/bridgeAction.js b/src/actions/bridgeAction.js
deleted file mode 100644
index 24b864cd..00000000
--- a/src/actions/bridgeAction.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-Copyright 2021-present Boba Network.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License. */
-
-import store from "store";
-
-export function setToken(token) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/TOKEN/SELECT', payload: token });
- }
-}
-
-export function resetToken() {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/TOKEN/RESET' });
- }
-}
-
-export function removeToken(tokenIndex) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/TOKEN/REMOVE', payload: tokenIndex });
- }
-}
-
-export function setTokenAmount(payload) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/TOKEN/AMOUNT/CHANGE', payload });
- }
-}
-
-export function updateToken(payload) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/TOKEN/UPDATE', payload });
- }
-}
-
-export function setBridgeType(type) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/TYPE/SELECT', payload: type });
- }
-}
-
-export function setMultiBridgeMode(mode) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/MODE/CHANGE', payload: mode });
- }
-}
-
-export function setBridgeDestinationAddress(payload) {
- return function (dispatch) {
- return dispatch({type: 'BRIDGE/DESTINATION_ADDRESS/SET', payload })
- }
-}
-
-export function resetBridgeDestinationAddress() {
- return function(dispatch) {
- return dispatch({type: 'BRIDGE/DESTINATION_ADDRESS/RESET'});
- }
-}
-
-// updates value indicating wether the 'to address' field should be available
-export function setBridgeDestinationAddressAvailable(payload) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/DESTINATION_ADDRESS_AVAILABLE/SET', payload });
- }
-}
-
-export function setBridgeAlert(payload) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/ALERT/SET', payload });
- }
-}
-
-export function clearBridgeAlert(payload) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/ALERT/CLEAR', payload });
- }
-}
-
-export function purgeBridgeAlert(payload) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/ALERT/PURGE', payload });
- }
-}
-
-export function setAmountToBridge(payload) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/AMOUNT/SET', payload });
- }
-}
-
-export function resetBridgeAmount() {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/AMOUNT/RESET'});
- }
-}
-
-export function setTeleportationOfAssetSupported(payload) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/TELEPORTER/TOKEN_SUPPORTED', payload})
- }
-}
-
-export function setTeleportationDestChainId(payload) {
- return function (dispatch) {
- return dispatch({ type: 'BRIDGE/TELEPORTER/DEST_CHAIN_ID', payload})
- }
-}
-
-export function setFetchDepositTxBlock(payload) {
- store.dispatch({ type: 'BRIDGE/DEPOSIT_TX/BLOCK', payload})
-}
diff --git a/src/actions/bridgeAction.ts b/src/actions/bridgeAction.ts
new file mode 100644
index 00000000..e92799e3
--- /dev/null
+++ b/src/actions/bridgeAction.ts
@@ -0,0 +1,82 @@
+/*
+Copyright 2021-present Boba Network.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License. */
+
+import store from 'store'
+import { BigNumberish } from 'ethers'
+
+export interface IBridgeAltert {
+ meta: string
+ type: string
+ text: string
+}
+
+export const resetToken = () => (dispatch) =>
+ dispatch({ type: 'BRIDGE/TOKEN/RESET' })
+
+export const updateToken = (payload?) => (dispatch) =>
+ dispatch({ type: 'BRIDGE/TOKEN/UPDATE', payload })
+
+export const setBridgeType = (type) => (dispatch) =>
+ dispatch({ type: 'BRIDGE/TYPE/SELECT', payload: type })
+
+export const setBridgeDestinationAddress = (payload: string) => (dispatch) =>
+ dispatch({
+ type: 'BRIDGE/DESTINATION_ADDRESS/SET',
+ payload,
+ })
+
+export const resetBridgeDestinationAddress = () => (dispatch) =>
+ dispatch({ type: 'BRIDGE/DESTINATION_ADDRESS/RESET' })
+
+// updates value indicating wether the 'to address' field should be available
+export const setBridgeDestinationAddressAvailable =
+ (payload: boolean) => (dispatch) =>
+ dispatch({
+ type: 'BRIDGE/DESTINATION_ADDRESS_AVAILABLE/SET',
+ payload,
+ })
+
+export const setBridgeAlert = (payload: IBridgeAltert) => (dispatch) =>
+ dispatch({ type: 'BRIDGE/ALERT/SET', payload })
+
+export const clearBridgeAlert = (payload: { keys: string[] }) => (dispatch) =>
+ dispatch({ type: 'BRIDGE/ALERT/CLEAR', payload })
+
+export const purgeBridgeAlert = (payload?) => (dispatch) =>
+ dispatch({ type: 'BRIDGE/ALERT/PURGE', payload })
+
+export const setAmountToBridge = (payload?) => (dispatch) =>
+ dispatch({ type: 'BRIDGE/AMOUNT/SET', payload })
+
+export const resetBridgeAmount = () => (dispatch) =>
+ dispatch({ type: 'BRIDGE/AMOUNT/RESET' })
+
+export const setTeleportationOfAssetSupported =
+ (payload: boolean) => (dispatch) =>
+ dispatch({
+ type: 'BRIDGE/TELEPORTER/TOKEN_SUPPORTED',
+ payload,
+ })
+
+export const setTeleportationDestChainId =
+ (payload: BigNumberish) => (dispatch) =>
+ dispatch({
+ type: 'BRIDGE/TELEPORTER/DEST_CHAIN_ID',
+ payload,
+ })
+
+export const setFetchDepositTxBlock = (payload?) => {
+ store.dispatch({ type: 'BRIDGE/DEPOSIT_TX/BLOCK', payload })
+}
diff --git a/src/actions/createAction.js b/src/actions/createAction.js
deleted file mode 100644
index 6b99479d..00000000
--- a/src/actions/createAction.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
-Copyright 2021-present Boba Network.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License. */
-
-import * as Sentry from '@sentry/react';
-
-export function createAction (key, asyncAction) {
-
- return async function (dispatch) {
-
- dispatch({ type: `${key}/REQUEST` })
-
- try {
- const response = await asyncAction()
-
- if( response === false ) {
- return false
- }
-
- if(response && typeof(response) === 'string' && response?.includes('execution reverted: ERC20Permit')) {
- let errorMessage = JSON.parse(response)
- dispatch({ type: `UI/ERROR/UPDATE`, payload: errorMessage.error.message })
- dispatch({ type: `${key}/ERROR` })
- Sentry.captureMessage(errorMessage.error.message);
- return false
- }
-
- if(response && typeof(response) === 'string' && response?.includes('Insufficient balance')) {
- //let errorMessage = JSON.parse(response)
- dispatch({ type: `UI/ERROR/UPDATE`, payload: "Insufficient BOBA balance for emergency swap" })
- dispatch({ type: `${key}/ERROR` })
- Sentry.captureMessage("Insufficient BOBA balance for emergency swap");
- return false
- }
-
- //deal with metamask errors - they will have a 'code' field so we can detect those
- if(response && response.hasOwnProperty('message') && response.hasOwnProperty('code')) {
- Sentry.captureMessage(response.reason)
- if(response.hasOwnProperty('reason')) console.log("Error reason:", response.reason)
-
- // the basic error message
- let errorMessage = response.message
-
- // provide more information in special cases
- // MetaMask user rejected sig - throw up a banner
- if ((response.code === 4001 ||
- response.hasOwnProperty('reason'))
- && response?.reason?.includes('user rejected transaction')
- ) {
- console.log("MetaMask: user denied signature")
- errorMessage = 'MetaMask: Transaction was rejected by user - signature denied'
- }
- // No internet case - throw up a banner
- else if(response.hasOwnProperty('reason') && response?.reason?.includes('could not detect network')) {
- console.log("Gateway error: No network")
- errorMessage = 'Gateway: No internet'
- }
- // ethers error
- else if(response.hasOwnProperty('reason') && response.reason?.includes('missing revert data in call exception')) {
- console.log("Slow network or rate throttling - code 1")
- // intercept error
- return false
- }
- // ethers error
- else if(response.hasOwnProperty('reason') && response.reason?.includes('resolver or addr is not configured for ENS name')) {
- console.log("Slow network or rate throttling - code 2")
- // intercept error
- return false
- }
- // ethers error
- else if(response.hasOwnProperty('reason') && response.reason?.includes('missing response')) {
- console.log("Slow network or rate throttling - code 3")
- // intercept error
- return false
- }
-
- dispatch({ type: `UI/ERROR/UPDATE`, payload: errorMessage })
- dispatch({ type: `${key}/ERROR` })
-
- return false
- }
-
- dispatch({ type: `${key}/SUCCESS`, payload: response })
- return response || true
-
- } catch (error) {
- console.log("Unhandled error RAW:", { error, key, asyncAction })
-
- Sentry.captureException(error);
- return false
- }
- }
-}
diff --git a/src/actions/createAction.ts b/src/actions/createAction.ts
new file mode 100644
index 00000000..9fe32ec6
--- /dev/null
+++ b/src/actions/createAction.ts
@@ -0,0 +1,135 @@
+/*
+Copyright 2021-present Boba Network.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License. */
+
+import * as Sentry from '@sentry/react'
+
+export const createAction =
+ (key: string, asyncAction: () => any) => async (dispatch) => {
+ dispatch({ type: `${key}/REQUEST` })
+
+ try {
+ const response = await asyncAction()
+
+ if (response === false) {
+ return false
+ }
+
+ if (
+ response &&
+ typeof response === 'string' &&
+ response?.includes('execution reverted: ERC20Permit')
+ ) {
+ const errorMessage = JSON.parse(response)
+ dispatch({
+ type: `UI/ERROR/UPDATE`,
+ payload: errorMessage.error.message,
+ })
+ dispatch({ type: `${key}/ERROR` })
+ Sentry.captureMessage(errorMessage.error.message)
+ return false
+ }
+
+ if (
+ response &&
+ typeof response === 'string' &&
+ response?.includes('Insufficient balance')
+ ) {
+ //let errorMessage = JSON.parse(response)
+ dispatch({
+ type: `UI/ERROR/UPDATE`,
+ payload: 'Insufficient BOBA balance for emergency swap',
+ })
+ dispatch({ type: `${key}/ERROR` })
+ Sentry.captureMessage('Insufficient BOBA balance for emergency swap')
+ return false
+ }
+
+ //deal with metamask errors - they will have a 'code' field so we can detect those
+ if (
+ response &&
+ response.hasOwnProperty('message') &&
+ response.hasOwnProperty('code')
+ ) {
+ Sentry.captureMessage(response.reason)
+ if (response.hasOwnProperty('reason')) {
+ console.log('Error reason:', response.reason)
+ }
+
+ // the basic error message
+ let errorMessage = response.message
+
+ // provide more information in special cases
+ // MetaMask user rejected sig - throw up a banner
+ if (
+ (response.code === 4001 || response.hasOwnProperty('reason')) &&
+ response?.reason?.includes('user rejected transaction')
+ ) {
+ console.log('MetaMask: user denied signature')
+ errorMessage =
+ 'MetaMask: Transaction was rejected by user - signature denied'
+ }
+ // No internet case - throw up a banner
+ else if (
+ response.hasOwnProperty('reason') &&
+ response?.reason?.includes('could not detect network')
+ ) {
+ console.log('Gateway error: No network')
+ errorMessage = 'Gateway: No internet'
+ }
+ // ethers error
+ else if (
+ response.hasOwnProperty('reason') &&
+ response.reason?.includes('missing revert data in call exception')
+ ) {
+ console.log('Slow network or rate throttling - code 1')
+ // intercept error
+ return false
+ }
+ // ethers error
+ else if (
+ response.hasOwnProperty('reason') &&
+ response.reason?.includes(
+ 'resolver or addr is not configured for ENS name'
+ )
+ ) {
+ console.log('Slow network or rate throttling - code 2')
+ // intercept error
+ return false
+ }
+ // ethers error
+ else if (
+ response.hasOwnProperty('reason') &&
+ response.reason?.includes('missing response')
+ ) {
+ console.log('Slow network or rate throttling - code 3')
+ // intercept error
+ return false
+ }
+
+ dispatch({ type: `UI/ERROR/UPDATE`, payload: errorMessage })
+ dispatch({ type: `${key}/ERROR` })
+
+ return false
+ }
+
+ dispatch({ type: `${key}/SUCCESS`, payload: response })
+ return response || true
+ } catch (error) {
+ console.log('Unhandled error RAW:', { error, key, asyncAction })
+
+ Sentry.captureException(error)
+ return false
+ }
+ }
diff --git a/src/actions/daoAction.js b/src/actions/daoAction.js
deleted file mode 100644
index e434d5f6..00000000
--- a/src/actions/daoAction.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- Varna - A Privacy-Preserving Marketplace
- Varna uses Fully Homomorphic Encryption to make markets fair.
- Copyright (C) 2021 Enya Inc. Palo Alto, CA
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-*/
-
-import networkService from 'services/networkService';
-import { createAction } from './createAction'
-
-/***********************************************/
-/***** DAO Action *****/
-/***********************************************/
-
-export function fetchDaoBalance() {
- return createAction('BALANCE/DAO/GET', () => networkService.getDaoBalance())
-}
-
-export function fetchDaoVotes() {
- return createAction('VOTES/DAO/GET', () => networkService.getDaoVotes())
-}
-
-export function fetchDaoBalanceX() {
- return createAction('BALANCEX/DAO/GET', () => networkService.getDaoBalanceX())
-}
-
-export function fetchDaoVotesX() {
- return createAction('VOTESX/DAO/GET', () => networkService.getDaoVotesX())
-}
-
-export function transferDao({ recipient, amount }) {
- return createAction('TRANSFER/DAO/CREATE', () => networkService.transferDao({ recipient, amount }))
-}
-
-export function delegateVotes({ recipient }) {
- return createAction('DELEGATE/VOTES/CREATE', () => networkService.delegateVotes({ recipient }))
-}
-
-export function delegateVotesX({ recipient }) {
- return createAction('DELEGATEX/VOTES/CREATE', () => networkService.delegateVotesX({ recipient }))
-}
-
-export function getProposalThreshold() {
- return createAction('PROPOSALTHRESHOLD/GET', () => networkService.getProposalThreshold())
-}
-
-export function fetchDaoProposals() {
- return createAction('PROPOSALS/GET', () => networkService.fetchProposals())
-}
-
-export function createDaoProposal(payload) {
- return createAction('PROPOSAL/CREATE', () => networkService.createProposal(payload))
-}
-
-export function queueProposal(proposalID) {
- return createAction('PROPOSAL/QUEUE', () => networkService.queueProposal(proposalID))
-}
-
-export function executeProposal(proposalID) {
- return createAction('PROPOSAL/EXECUTE', () => networkService.executeProposal(proposalID))
-}
-
-export function castProposalVote(payload) {
- return createAction('PROPOSAL/CAST/VOTE', () => networkService.castProposalVote(payload))
-}
-
-
diff --git a/src/actions/daoAction.ts b/src/actions/daoAction.ts
new file mode 100644
index 00000000..f61857d1
--- /dev/null
+++ b/src/actions/daoAction.ts
@@ -0,0 +1,72 @@
+/*
+ Varna - A Privacy-Preserving Marketplace
+ Varna uses Fully Homomorphic Encryption to make markets fair.
+ Copyright (C) 2021 Enya Inc. Palo Alto, CA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+import networkService from 'services/networkService'
+import { createAction } from './createAction'
+
+/***********************************************/
+/***** DAO Action *****/
+/***********************************************/
+
+/***** DAO Action *****/
+export const fetchDaoBalance = () =>
+ createAction('BALANCE/DAO/GET', () => networkService.getDaoBalance())
+
+export const fetchDaoVotes = () =>
+ createAction('VOTES/DAO/GET', () => networkService.getDaoVotes())
+
+export const fetchDaoBalanceX = () =>
+ createAction('BALANCEX/DAO/GET', () => networkService.getDaoBalanceX())
+
+export const fetchDaoVotesX = () =>
+ createAction('VOTESX/DAO/GET', () => networkService.getDaoVotesX())
+
+export const delegateVotes = ({ recipient }) =>
+ createAction('DELEGATE/VOTES/CREATE', () =>
+ networkService.delegateVotes({ recipient })
+ )
+
+export const delegateVotesX = ({ recipient }) =>
+ createAction('DELEGATEX/VOTES/CREATE', () =>
+ networkService.delegateVotesX({ recipient })
+ )
+
+export const getProposalThreshold = () =>
+ createAction('PROPOSALTHRESHOLD/GET', () =>
+ networkService.getProposalThreshold()
+ )
+
+export const fetchDaoProposals = () =>
+ createAction('PROPOSALS/GET', () => networkService.fetchProposals())
+
+export const createDaoProposal = (payload) =>
+ createAction('PROPOSAL/CREATE', () => networkService.createProposal(payload))
+
+export const queueProposal = (proposalID) =>
+ createAction('PROPOSAL/QUEUE', () => networkService.queueProposal(proposalID))
+
+export const executeProposal = (proposalID) =>
+ createAction('PROPOSAL/EXECUTE', () =>
+ networkService.executeProposal(proposalID)
+ )
+
+export const castProposalVote = (payload) =>
+ createAction('PROPOSAL/CAST/VOTE', () =>
+ networkService.castProposalVote(payload)
+ )
diff --git a/src/actions/devToolsAction.js b/src/actions/devToolsAction.ts
similarity index 67%
rename from src/actions/devToolsAction.js
rename to src/actions/devToolsAction.ts
index ab0b064f..5ac55510 100644
--- a/src/actions/devToolsAction.js
+++ b/src/actions/devToolsAction.ts
@@ -17,15 +17,19 @@
along with this program. If not, see .
*/
-import networkService from 'services/networkService';
+import networkService from 'services/networkService'
import { createAction } from './createAction'
+import { Contract } from 'ethers'
-export function submitTxBuilder(contract, methodIndex, methodName, inputs) {
- return createAction('TX_BUILDER', () => networkService.submitTxBuilder(contract, methodIndex, methodName, inputs))
-}
+export const submitTxBuilder = (
+ contract: Contract,
+ methodIndex: number,
+ methodName: string,
+ inputs: any
+) =>
+ createAction('TX_BUILDER', () =>
+ networkService.submitTxBuilder(contract, methodIndex, methodName, inputs)
+ )
-export function resetTxBuilder() {
- return function (dispatch) {
- return dispatch({ type: 'TX_BUILDER/REST'})
- }
-}
+export const resetTxBuilder = () => (dispatch) =>
+ dispatch({ type: 'TX_BUILDER/REST' })
diff --git a/src/actions/earnAction.js b/src/actions/earnAction.js
deleted file mode 100644
index e7d0b911..00000000
--- a/src/actions/earnAction.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- Varna - A Privacy-Preserving Marketplace
- Varna uses Fully Homomorphic Encryption to make markets fair.
- Copyright (C) 2021 Enya Inc. Palo Alto, CA
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-*/
-
-import networkService from 'services/networkService'
-import { createAction } from './createAction'
-
-const getEarnInfoBegin = () => ({
- type: 'GET_EARNINFO',
-})
-
-const getEarnInfoSuccess = (L1PoolInfo, L1UserInfo, L2PoolInfo, L2UserInfo) => ({
- type: 'GET_EARNINFO_SUCCESS',
- payload: { L1PoolInfo, L1UserInfo, L2PoolInfo, L2UserInfo }
-})
-
-// const getL1FeeBegin = () => ({
-// type: 'GET_USERINFO',
-// })
-
-// const getL2FeeBegin = () => ({
-// type: 'GET_USERINFO',
-// })
-
-// const getL1FeeSuccess = (totalFeeRate, userRewardFeeRate) => ({
-// type: 'GET_L1FEE_SUCCESS',
-// payload: { totalFeeRate, userRewardFeeRate },
-// })
-
-// const getL2FeeSuccess = (totalFeeRate, userRewardFeeRate) => ({
-// type: 'GET_L2FEE_SUCCESS',
-// payload: { totalFeeRate, userRewardFeeRate },
-// })
-
-export const getEarnInfo = () => async (dispatch) => {
- dispatch(getEarnInfoBegin())
- const [L1LPInfo, L2LPInfo] = await Promise.all([
- networkService.getL1LPInfo(),
- networkService.getL2LPInfo(),
- ])
- dispatch(getEarnInfoSuccess(
- L1LPInfo.poolInfo,
- L1LPInfo.userInfo,
- L2LPInfo.poolInfo,
- L2LPInfo.userInfo,
- ))
-}
-
-// export const getL1Fee = () => async (dispatch) => {
-// dispatch(getL1FeeBegin())
-// const [totalFeeRate, userFeeRate] = await Promise.all([
-// networkService.getL1TotalFeeRate(),
-// networkService.getL1UserRewardFeeRate(),
-// ])
-// console.log("L1 totalFeeRate",totalFeeRate)
-// console.log("L1 userRewardFeeRate",userFeeRate)
-// dispatch(getL1FeeSuccess(totalFeeRate, userFeeRate))
-// }
-
-// export const getL2Fee = () => async (dispatch) => {
-// dispatch(getL2FeeBegin())
-// const [totalFeeRate, userFeeRate] = await Promise.all([
-// networkService.getL2TotalFeeRate(),
-// networkService.getL2UserRewardFeeRate(),
-// ])
-// console.log("L2 totalFeeRate",totalFeeRate)
-// console.log("L2 userRewardFeeRate",userFeeRate)
-// dispatch(getL2FeeSuccess(totalFeeRate, userFeeRate))
-// }
-
-export function fetchL1UserFee(currency) {return createAction('FETCH/L1USERFEE', () => networkService.getL1UserRewardFeeRate(currency))}
-export function fetchL2UserFee(currency) {return createAction('FETCH/L2USERFEE', () => networkService.getL2UserRewardFeeRate(currency))}
-
-export const updateStakeToken = (stakeToken) => ({
- type: 'UPDATE_STAKE_TOKEN',
- payload: stakeToken,
-})
-
-export const updateWithdrawToken = (withdrawToken) => ({
- type: 'UPDATE_WITHDRAW_TOKEN',
- payload: withdrawToken,
-})
-
-export function fetchAllowance(currency, lpAddress) {
- return createAction('FETCH/ALLOWANCE', () => networkService.checkAllowance(
- currency,
- lpAddress
- ))
-}
-
-export function addLiquidity(
- currency,
- weiString,
- L1orL2Pool
-) {
- return createAction('ADD/LIQUIDITY', () => networkService.addLiquidity(
- currency,
- weiString,
- L1orL2Pool
- ))
-}
-
-export function fetchL1LPBalance(currency) {
- return createAction('FETCH/L1LPBALANCE', () => networkService.L1LPBalance(currency))
-}
-
-export function fetchL2LPBalance(currency) {
- return createAction('FETCH/L2LPBALANCE', () => networkService.L2LPBalance(currency))
-}
diff --git a/src/actions/earnAction.ts b/src/actions/earnAction.ts
new file mode 100644
index 00000000..860dbf7b
--- /dev/null
+++ b/src/actions/earnAction.ts
@@ -0,0 +1,81 @@
+/*
+ Varna - A Privacy-Preserving Marketplace
+ Varna uses Fully Homomorphic Encryption to make markets fair.
+ Copyright (C) 2021 Enya Inc. Palo Alto, CA
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see .
+*/
+
+import networkService from 'services/networkService'
+import { createAction } from './createAction'
+
+const getEarnInfoBegin = () => ({
+ type: 'GET_EARNINFO',
+})
+
+const getEarnInfoSuccess = (
+ L1PoolInfo,
+ L1UserInfo,
+ L2PoolInfo,
+ L2UserInfo
+) => ({
+ type: 'GET_EARNINFO_SUCCESS',
+ payload: { L1PoolInfo, L1UserInfo, L2PoolInfo, L2UserInfo },
+})
+
+export const getEarnInfo = () => async (dispatch) => {
+ dispatch(getEarnInfoBegin())
+ const [L1LPInfo, L2LPInfo] = await Promise.all([
+ networkService.getL1LPInfo(),
+ networkService.getL2LPInfo(),
+ ])
+ dispatch(
+ getEarnInfoSuccess(
+ L1LPInfo.poolInfo,
+ L1LPInfo.userInfo,
+ L2LPInfo.poolInfo,
+ L2LPInfo.userInfo
+ )
+ )
+}
+
+export const updateStakeToken = (stakeToken: string) => ({
+ type: 'UPDATE_STAKE_TOKEN',
+ payload: stakeToken,
+})
+
+export const updateWithdrawToken = (withdrawToken: string) => ({
+ type: 'UPDATE_WITHDRAW_TOKEN',
+ payload: withdrawToken,
+})
+
+export const fetchAllowance = (currency: string, lpAddress: string) =>
+ createAction('FETCH/ALLOWANCE', () =>
+ networkService.checkAllowance(currency, lpAddress)
+ )
+
+export const addLiquidity = (
+ currency: string,
+ weiString: string,
+ L1orL2Pool: string
+) =>
+ createAction('ADD/LIQUIDITY', () =>
+ networkService.addLiquidity(currency, weiString, L1orL2Pool)
+ )
+
+export const fetchL1LPBalance = (currency: string) =>
+ createAction('FETCH/L1LPBALANCE', () => networkService.L1LPBalance(currency))
+
+export const fetchL2LPBalance = (currency: string) =>
+ createAction('FETCH/L2LPBALANCE', () => networkService.L2LPBalance(currency))
diff --git a/src/actions/fixedAction.js b/src/actions/fixedAction.ts
similarity index 64%
rename from src/actions/fixedAction.js
rename to src/actions/fixedAction.ts
index d6058090..09694f53 100644
--- a/src/actions/fixedAction.js
+++ b/src/actions/fixedAction.ts
@@ -20,18 +20,16 @@
import networkService from 'services/networkService'
import { createAction } from './createAction'
-export function addFS_Savings(weiString) {
- return createAction('ADD/FS_SAVINGS', () => networkService.addFS_Savings(weiString))
-}
+export const addFS_Savings = (weiString: string) =>
+ createAction('ADD/FS_SAVINGS', () => networkService.addFS_Savings(weiString))
-export function withdrawFS_Savings(stakeID) {
- return createAction('WITHDRAW/FS_SAVINGS', () => networkService.withdrawFS_Savings(stakeID))
-}
+export const withdrawFS_Savings = (stakeID: number) =>
+ createAction('WITHDRAW/FS_SAVINGS', () =>
+ networkService.withdrawFS_Savings(stakeID)
+ )
-export function getFS_Saves(currency) {
- return createAction('GET/FS_SAVES', () => networkService.getFS_Saves())
-}
+export const getFS_Saves = () =>
+ createAction('GET/FS_SAVES', () => networkService.getFS_Saves())
-export function getFS_Info(currency) {
- return createAction('GET/FS_INFO', () => networkService.getFS_Info())
-}
\ No newline at end of file
+export const getFS_Info = () =>
+ createAction('GET/FS_INFO', () => networkService.getFS_Info())
diff --git a/src/actions/networkAction.js b/src/actions/networkAction.js
deleted file mode 100644
index c3c1fc38..00000000
--- a/src/actions/networkAction.js
+++ /dev/null
@@ -1,283 +0,0 @@
-/*
-Copyright 2021-present Boba Network.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License. */
-
-import networkService from 'services/networkService'
-import transactionService from 'services/transaction.service'
-import { createAction } from './createAction'
-
-export function fetchBalances() {
- return createAction('BALANCE/GET', () => networkService.getBalances())
-}
-
-export function addTokenList() {
- return createAction('TOKENLIST/GET', () => networkService.addTokenList())
-}
-
-export function fetchTransactions() {
- return createAction('TRANSACTION/GETALL', () =>
- transactionService.getTransactions()
- )
-}
-
-export function fetchSevens() {
- return createAction('SEVENS/GETALL', () =>
- transactionService.getSevens()
- )
-}
-
-export function fetchFastExits() {
- return createAction('FASTEXITS/GETALL', () =>
- transactionService.getFastExits()
- )
-}
-
-export function exitBOBA(token, value) {
- return createAction('EXIT/CREATE', () =>
- networkService.exitBOBA(token, value)
- )
-}
-
-//SWAP RELATED
-export function depositL1LP(currency,value) {
- return createAction('DEPOSIT/CREATE', () =>
- networkService.depositL1LP(currency,value)
- )
-}
-
-export function isTeleportationOfAssetSupported(layer, asset, destChainId) {
- return createAction('DEPOSIT/TELEPORTATION/TOKEN_SUPPORTED', () =>
- networkService.isTeleportationOfAssetSupported(layer, asset, destChainId)
- )
-}
-
-export function depositWithTeleporter(layer, currency, value, destChainId) {
- return createAction('DEPOSIT/CREATE', () =>
- networkService.depositWithTeleporter(layer, currency, value, destChainId)
- )
-}
-
-export function depositL1LPBatch(payload) {
- return createAction('DEPOSIT/CREATE', () =>
- networkService.depositL1LPBatch(payload)
- )
-}
-
-//SWAP RELATED - Depositing into the L2LP triggers the swap-exit
-export function depositL2LP(token, value) {
- return createAction('EXIT/CREATE', () =>
- networkService.depositL2LP(token, value)
- )
-}
-
-//SWAP RELATED - Depositing into the L2LP triggers the swap-exit - variant of depositL2LP
-//that handles Exit All
-export function fastExitAll(token) {
- return createAction('EXIT/CREATE', () =>
- networkService.fastExitAll(token)
- )
-}
-
-//CLASSIC DEPOSIT ETH
-export function depositETHL2(payload) {
- return createAction('DEPOSIT/CREATE', () => {
- return networkService.depositETHL2(payload)
- }
- )
-}
-
-//DEPOSIT ERC20
-export function depositErc20(payload) {
- return createAction('DEPOSIT/CREATE', () =>
- networkService.depositErc20(payload)
- )
-}
-
-//DEPOSIT ERC20 to Alt L1 bridge
-export function depositErc20ToL1(payload) {
- return createAction('DEPOSIT_ALTL1/CREATE', () => networkService.depositErc20ToL1(payload))
-}
-
-//EARN
-export function earnL1(value_Wei_String, currencyAddress) {
- return createAction('EARN/CREATE', () =>
- networkService.approveERC20_L1LP(value_Wei_String, currencyAddress)
- )
-}
-export function earnL2(value_Wei_String, currencyAddress) {
- return createAction('EARN/CREATE', () =>
- networkService.approveERC20_L2LP(value_Wei_String, currencyAddress)
- )
-}
-export function getReward(currencyAddress, value_Wei_String, L1orL2Pool) {
- return createAction('EARN/HARVEST', () =>
- networkService.getReward(currencyAddress, value_Wei_String, L1orL2Pool)
- )
-}
-
-export function withdrawLiquidity(currencyAddress, value_Wei_String, L1orL2Pool) {
-
- return createAction('EARN/WITHDRAW', () =>
- networkService.withdrawLiquidity(currencyAddress, value_Wei_String, L1orL2Pool)
- )
-}
-
-export function approveERC20(
- value,
- currency,
- approveContractAddress,
- contractABI
-) {
- return createAction('APPROVE/CREATE', () =>
- networkService.approveERC20(
- value,
- currency,
- approveContractAddress,
- contractABI
- )
- )
-}
-
-export function approveFastDepositBatch(payload) {
- return createAction('APPROVE/CREATE', () =>
- networkService.approveFastDepositBatch(
- payload
- )
- )
-}
-
-export function approveERC20_L2LP(
- value,
- currency,
-) {
- return createAction('APPROVE/CREATE', () =>
- networkService.approveERC20_L2LP(
- value,
- currency,
- )
- )
-}
-
-export function approveERC20_L1LP(
- value,
- currency,
-) {
- return createAction('APPROVE/CREATE', () =>
- networkService.approveERC20_L1LP(
- value,
- currency,
- )
- )
-}
-
-export function transfer(recipient, value, currency) {
- return createAction('TRANSFER/CREATE', () =>
- networkService.transfer(recipient, value, currency)
- )
-}
-
-export function transferEstimate(value_Wei_String, currency) {
- return createAction('TRANSFER_ESTIMATE/CREATE', () =>
- networkService.transferEstimate(value_Wei_String, currency)
- )
-}
-
-export function transferNFT(recipient, nft) {
- return createAction('TRANSFER_NFT/CREATE', () =>
- networkService.transferNFT(recipient, nft)
- )
-}
-
-export function settle_v0() {
- return createAction('SETTLE_v0/CREATE', () =>
- networkService.settle_v0()
- )
-}
-
-export function settle_v1() {
- return createAction('SETTLE_v1/CREATE', () =>
- networkService.settle_v1()
- )
-}
-
-export function settle_v2() {
- return createAction('SETTLE_v2/CREATE', () =>
- networkService.settle_v2()
- )
-}
-
-export function settle_v2OLO() {
- return createAction('SETTLE_v2OLO/CREATE', () =>
- networkService.settle_v2OLO()
- )
-}
-
-export function settle_v3() {
- return createAction('SETTLE_v3/CREATE', () =>
- networkService.settle_v3()
- )
-}
-
-export function settle_v3OLO() {
- return createAction('SETTLE_v3OLO/CREATE', () =>
- networkService.settle_v3OLO()
- )
-}
-
-export function fetchLookUpPrice(params) {
- return createAction('PRICE/GET', () =>
- networkService.fetchLookUpPrice(params))
-}
-
-export function clearLookupPrice() {
- return function (dispatch) {
- return dispatch({ type: 'LOOKUP/PRICE/CLEAR' })
- }
-}
-
-export function enableBrowserWallet(network) {
- return createAction('ENABLE/BROWSER/WALLET', () => networkService.enableBrowserWallet(network))
-}
-
-export function getAllAddresses() {
- return createAction('GET/ALL/ADDRESS', () => networkService.getAllAddresses())
-}
-
-
-/********************************/
-/******ONE GATEWAY ACTIONS *****/
-/********************************/
-/**
- * @params
- * network - ethereum, bnb, avax
- * networkType - MAINNET, TESTNET
-*/
-export function setNetwork(payload) {
- return function (dispatch) {
- return dispatch({ type: 'NETWORK/SET', payload: payload })
- }
-}
-
-// to update the active network.
-export function setActiveNetwork(payload) {
- return function (dispatch) {
- return dispatch({ type: 'NETWORK/SET/ACTIVE' })
- }
-}
-
-export function setActiveNetworkType(payload) {
- return function (dispatch) {
- return dispatch({ type: 'NETWORK/SET_TYPE/ACTIVE', payload })
- }
-}
diff --git a/src/actions/networkAction.ts b/src/actions/networkAction.ts
new file mode 100644
index 00000000..9212736a
--- /dev/null
+++ b/src/actions/networkAction.ts
@@ -0,0 +1,163 @@
+/*
+Copyright 2021-present Boba Network.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License. */
+
+import networkService from 'services/networkService'
+import transactionService from 'services/transaction.service'
+import { createAction } from './createAction'
+import { BigNumberish } from 'ethers'
+
+export const fetchBalances = () =>
+ createAction('BALANCE/GET', () => networkService.getBalances())
+
+export const addTokenList = () =>
+ createAction('TOKENLIST/GET', () => networkService.addTokenList())
+
+export const fetchTransactions = () =>
+ createAction('TRANSACTION/GETALL', () => transactionService.getTransactions())
+
+export const fetchSevens = () =>
+ createAction('SEVENS/GETALL', () => transactionService.getSevens())
+
+export const fetchFastExits = () =>
+ createAction('FASTEXITS/GETALL', () => transactionService.getFastExits())
+
+export const exitBOBA = (token: string, value: BigNumberish) =>
+ createAction('EXIT/CREATE', () => networkService.exitBOBA(token, value))
+
+//SWAP RELATED
+export const depositL1LP = (currency: string, value: BigNumberish) =>
+ createAction('DEPOSIT/CREATE', () =>
+ networkService.depositL1LP(currency, value)
+ )
+
+export const isTeleportationOfAssetSupported = (
+ layer: string,
+ asset: string,
+ destChainId: string
+) =>
+ createAction('DEPOSIT/TELEPORTATION/TOKEN_SUPPORTED', () =>
+ networkService.isTeleportationOfAssetSupported(layer, asset, destChainId)
+ )
+
+export const depositWithLightBridge = (
+ layer: string,
+ currency: string,
+ value: BigNumberish,
+ destChainId: BigNumberish
+) =>
+ createAction('DEPOSIT/CREATE', () =>
+ networkService.depositWithTeleporter(layer, currency, value, destChainId)
+ )
+
+//SWAP RELATED - Depositing into the L2LP triggers the swap-exit
+export const depositL2LP = (token: string, value: BigNumberish) =>
+ createAction('EXIT/CREATE', () => networkService.depositL2LP(token, value))
+
+//CLASSIC DEPOSIT ETH
+export const depositETHL2 = (payload) =>
+ createAction('DEPOSIT/CREATE', () => {
+ return networkService.depositETHL2(payload)
+ })
+
+//DEPOSIT ERC20
+export const depositErc20 = (payload) =>
+ createAction('DEPOSIT/CREATE', () => networkService.depositErc20(payload))
+
+//EARN
+export const earnL1 = (
+ value_Wei_String: BigNumberish,
+ currencyAddress: string
+) =>
+ createAction('EARN/CREATE', () =>
+ networkService.approveERC20_L1LP(value_Wei_String, currencyAddress)
+ )
+export const earnL2 = (
+ value_Wei_String: BigNumberish,
+ currencyAddress: string
+) =>
+ createAction('EARN/CREATE', () =>
+ networkService.approveERC20_L2LP(value_Wei_String, currencyAddress)
+ )
+export const getReward = (
+ currencyAddress: string,
+ value_Wei_String: BigNumberish,
+ L1orL2Pool: string
+) =>
+ createAction('EARN/HARVEST', () =>
+ networkService.getReward(currencyAddress, value_Wei_String, L1orL2Pool)
+ )
+
+export const withdrawLiquidity = (
+ currencyAddress: string,
+ value_Wei_String: string,
+ L1orL2Pool: string
+) =>
+ createAction('EARN/WITHDRAW', () =>
+ networkService.withdrawLiquidity(
+ currencyAddress,
+ value_Wei_String,
+ L1orL2Pool
+ )
+ )
+
+export const approveERC20 = (
+ value: BigNumberish,
+ currency: string,
+ approveContractAddress: string,
+ contractABI?
+) =>
+ createAction('APPROVE/CREATE', () =>
+ networkService.approveERC20(
+ value,
+ currency,
+ approveContractAddress,
+ contractABI
+ )
+ )
+
+export const transfer = (
+ recipient: string,
+ value: BigNumberish,
+ currency: string
+) =>
+ createAction('TRANSFER/CREATE', () =>
+ networkService.transfer(recipient, value, currency)
+ )
+
+export const fetchLookUpPrice = (params) =>
+ createAction('PRICE/GET', () => networkService.fetchLookUpPrice(params))
+
+export const clearLookupPrice = () => (dispatch) =>
+ dispatch({ type: 'LOOKUP/PRICE/CLEAR' })
+
+export const getAllAddresses = () =>
+ createAction('GET/ALL/ADDRESS', () => networkService.getAllAddresses())
+
+/********************************/
+/******ONE GATEWAY ACTIONS *****/
+/********************************/
+/**
+ * @param payload: {network: ethereum, bnb, networkType
+ * @param networkType: MAINNET, TESTNET
+ */
+export const setNetwork = (payload) => (dispatch) =>
+ dispatch({ type: 'NETWORK/SET', payload })
+
+// to update the active network.
+export const setActiveNetwork = () => (dispatch) =>
+ dispatch({ type: 'NETWORK/SET/ACTIVE' })
+
+export const setActiveNetworkType = (payload) => (dispatch) =>
+ dispatch({ type: 'NETWORK/SET_TYPE/ACTIVE', payload })
diff --git a/src/actions/setupAction.js b/src/actions/setupAction.js
deleted file mode 100644
index 0a5cc6d0..00000000
--- a/src/actions/setupAction.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
-Copyright 2021-present Boba Network.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License. */
-
-
-import networkService from 'services/networkService'
-import { createAction } from './createAction'
-import store from 'store'
-
-export function setEnableAccount(enabled) {
- return function (dispatch) {
- return dispatch({ type: 'SETUP/ACCOUNT/SET', payload: enabled })
- }
-}
-
-export function setBaseState(enabled) {
- return function (dispatch) {
- return dispatch({ type: 'SETUP/BASE/SET', payload: enabled })
- }
-}
-
-export function setLayer(layer) {
- return function (dispatch) {
- return dispatch({ type: 'SETUP/LAYER/SET', payload: layer })
- }
-}
-
-export function setWalletAddress(account) {
- return function (dispatch) {
- return dispatch({ type: 'SETUP/WALLETADDRESS/SET', payload: account })
- }
-}
-
-export function switchChain(layer) {
- return createAction('SETUP/SWITCH', () => networkService.switchChain(layer))
-}
-
-export function switchFee(targetFee) {
- return createAction('SETUP/SWITCHFEE', () => networkService.switchFee(targetFee))
-}
-
-export function getETHMetaTransaction() {
- return createAction('SETUP/GETETH', () => networkService.getETHMetaTransaction())
-}
-
-export async function addBobaFee ( bobaFee ) {
- store.dispatch({ type: 'BOBAFEE/ADD/SUCCESS', payload: bobaFee })
-}
-
-export function setConnectETH( state ) {
- return function (dispatch) {
- return dispatch({ type: 'SETUP/CONNECT_ETH', payload: state })
- }
-}
-
-export function setConnectBOBA( state ) {
- return function (dispatch) {
- return dispatch({ type: 'SETUP/CONNECT_BOBA', payload: state })
- }
-}
-
-export function setConnect( state ) {
- return function (dispatch) {
- return dispatch({ type: 'SETUP/CONNECT', payload: state })
- }
-}
-
-export function setWalletConnected( state ) {
- return function (dispatch) {
- return dispatch({ type: 'SETUP/WALLET_CONNECTED', payload: state })
- }
-}
-
-export function setChainIdChanged(state) {
- return function (dispatch) {
- return dispatch({ type: 'SETUP/CHAINIDCHANGED/SET', payload: state })
- }
-}
-
-export function resetChainIdChanged() {
- return function (dispatch) {
- return dispatch({ type: 'SETUP/CHAINIDCHANGED/RESET' })
- }
-}
-
-
-export function disconnectSetup() {
- return function(dispatch) {
- return dispatch({type: 'SETUP/DISCONNECT'})
- }
-}
\ No newline at end of file
diff --git a/src/actions/setupAction.ts b/src/actions/setupAction.ts
new file mode 100644
index 00000000..de92f2ad
--- /dev/null
+++ b/src/actions/setupAction.ts
@@ -0,0 +1,55 @@
+/*
+Copyright 2021-present Boba Network.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License. */
+
+import networkService from 'services/networkService'
+import { createAction } from './createAction'
+import store from 'store'
+
+export const setEnableAccount = (enabled) => (dispatch) =>
+ dispatch({ type: 'SETUP/ACCOUNT/SET', payload: enabled })
+
+export const setBaseState = (enabled) => (dispatch) =>
+ dispatch({ type: 'SETUP/BASE/SET', payload: enabled })
+
+export const setLayer = (layer) => (dispatch) =>
+ dispatch({ type: 'SETUP/LAYER/SET', payload: layer })
+
+export const setWalletAddress = (account) => (dispatch) =>
+ dispatch({ type: 'SETUP/WALLETADDRESS/SET', payload: account })
+
+export const switchFee = (targetFee) =>
+ createAction('SETUP/SWITCHFEE', () => networkService.switchFee(targetFee))
+
+export const getETHMetaTransaction = () =>
+ createAction('SETUP/GETETH', () => networkService.getETHMetaTransaction())
+
+export const addBobaFee = async (bobaFee) => {
+ store.dispatch({ type: 'BOBAFEE/ADD/SUCCESS', payload: bobaFee })
+}
+
+export const setConnectETH = (state) => (dispatch) =>
+ dispatch({ type: 'SETUP/CONNECT_ETH', payload: state })
+
+export const setConnectBOBA = (state) => (dispatch) =>
+ dispatch({ type: 'SETUP/CONNECT_BOBA', payload: state })
+
+export const setConnect = (state) => (dispatch) =>
+ dispatch({ type: 'SETUP/CONNECT', payload: state })
+
+export const setChainIdChanged = (state) => (dispatch) =>
+ dispatch({ type: 'SETUP/CHAINIDCHANGED/SET', payload: state })
+
+export const disconnectSetup = () => (dispatch) =>
+ dispatch({ type: 'SETUP/DISCONNECT' })
diff --git a/src/actions/signAction.js b/src/actions/signAction.ts
similarity index 55%
rename from src/actions/signAction.js
rename to src/actions/signAction.ts
index 562d869f..94b8a0eb 100644
--- a/src/actions/signAction.js
+++ b/src/actions/signAction.ts
@@ -13,16 +13,16 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
-import store from 'store';
+import store from 'store'
-export async function updateSignatureStatus_exitLP ( sigStatus ) {
- store.dispatch({type: 'EXIT/LP/SIGNED',payload: sigStatus})
+export const updateSignatureStatus_exitLP = async (sigStatus: boolean) => {
+ store.dispatch({ type: 'EXIT/LP/SIGNED', payload: sigStatus })
}
-export async function updateSignatureStatus_exitTRAD ( sigStatus ) {
- store.dispatch({type: 'EXIT/TRAD/SIGNED',payload: sigStatus})
+export const updateSignatureStatus_exitTRAD = async (sigStatus: boolean) => {
+ store.dispatch({ type: 'EXIT/TRAD/SIGNED', payload: sigStatus })
}
-export async function updateSignatureStatus_depositLP ( sigStatus ) {
- store.dispatch({type: 'DEPOSIT/LP/SIGNED',payload: sigStatus})
+export const updateSignatureStatus_depositLP = async (sigStatus: boolean) => {
+ store.dispatch({ type: 'DEPOSIT/LP/SIGNED', payload: sigStatus })
}
diff --git a/src/actions/tokenAction.js b/src/actions/tokenAction.ts
similarity index 58%
rename from src/actions/tokenAction.js
rename to src/actions/tokenAction.ts
index 4154462e..ad4afa75 100644
--- a/src/actions/tokenAction.js
+++ b/src/actions/tokenAction.ts
@@ -30,9 +30,10 @@ EVERYTHING IS INDEXED BY L1 TOKEN ADDRESS
const ETHL1 = '0x0000000000000000000000000000000000000000'
const ETHL2 = '0x4200000000000000000000000000000000000006'
-export async function getToken ( tokenContractAddressL1 ) {
-
- if( tokenContractAddressL1 === null) return
+export const getToken = async (tokenContractAddressL1: string) => {
+ if (tokenContractAddressL1 === null) {
+ return
+ }
//this *might* be coming from a person, and or copy-paste from Etherscan
//so need toLowerCase()
@@ -54,9 +55,10 @@ export async function getToken ( tokenContractAddressL1 ) {
/*
Get the token info from networkService.web3.eth.Contract
*/
-export async function addToken ( tokenContractAddressL1 ) {
-
- if( tokenContractAddressL1 === null ) return
+export const addToken = async (tokenContractAddressL1: string) => {
+ if (tokenContractAddressL1 === null) {
+ return
+ }
const state = store.getState()
@@ -68,93 +70,86 @@ export async function addToken ( tokenContractAddressL1 ) {
//if we already have looked it up, no need to look up again.
if (state.tokenList[_tokenContractAddressL1]) {
- console.log("token already in list:",_tokenContractAddressL1)
- return state.tokenList[_tokenContractAddressL1];
+ console.log('token already in list:', _tokenContractAddressL1)
+ return state.tokenList[_tokenContractAddressL1]
}
try {
-
- let tA = networkService.tokenAddresses
+ const tA: any = networkService.tokenAddresses
let tokenContract
- let _tokenContractAddressL2 = null
+ let _tokenContractAddressL2: string
/********* DO WE HAVE L2 DATA?? *************/
// Let's go see
// console.log("Addresses for lookup:", networkService.tokenAddresses)
- if(_tokenContractAddressL1 === 'xboba') {
- if(tA['xBOBA'].L2 !== null) _tokenContractAddressL2 = tA['xBOBA'].L2.toLowerCase()
+ if (_tokenContractAddressL1 === 'xboba') {
+ _tokenContractAddressL2 = tA['xBOBA']?.L2?.toLowerCase()
tokenContract = new ethers.Contract(
_tokenContractAddressL2,
erc20abi,
- networkService.L2Provider,
+ networkService.L2Provider!
)
} else if (_tokenContractAddressL1 === 'wagmiv0') {
- if(tA['WAGMIv0'].L2 !== null) _tokenContractAddressL2 = tA['WAGMIv0'].L2.toLowerCase()
+ _tokenContractAddressL2 = tA['WAGMIv0']?.L2?.toLowerCase()
tokenContract = new ethers.Contract(
_tokenContractAddressL2,
erc20abi,
- networkService.L2Provider,
+ networkService.L2Provider!
)
} else if (_tokenContractAddressL1 === 'wagmiv1') {
- if(tA['WAGMIv1'].L2 !== null) _tokenContractAddressL2 = tA['WAGMIv1'].L2.toLowerCase()
+ _tokenContractAddressL2 = tA['WAGMIv1']?.L2?.toLowerCase()
tokenContract = new ethers.Contract(
_tokenContractAddressL2,
erc20abi,
- networkService.L2Provider,
+ networkService.L2Provider!
)
- }
- else if (_tokenContractAddressL1 === 'wagmiv2') {
- if(tA['WAGMIv2'].L2 !== null) _tokenContractAddressL2 = tA['WAGMIv2'].L2.toLowerCase()
+ } else if (_tokenContractAddressL1 === 'wagmiv2') {
+ _tokenContractAddressL2 = tA['WAGMIv2']?.L2?.toLowerCase()
tokenContract = new ethers.Contract(
_tokenContractAddressL2,
erc20abi,
- networkService.L2Provider,
+ networkService.L2Provider!
)
- }
- else if (_tokenContractAddressL1 === 'wagmiv2-oolong') {
- if(tA['WAGMIv2-Oolong'].L2 !== null) _tokenContractAddressL2 = tA['WAGMIv2-Oolong'].L2.toLowerCase()
+ } else if (_tokenContractAddressL1 === 'wagmiv2-oolong') {
+ _tokenContractAddressL2 = tA['WAGMIv2-Oolong']?.L2?.toLowerCase()
tokenContract = new ethers.Contract(
_tokenContractAddressL2,
erc20abi,
- networkService.L2Provider,
+ networkService.L2Provider!
)
- }
- else if (_tokenContractAddressL1 === 'wagmiv3') {
- if(tA['WAGMIv3'].L2 !== null) _tokenContractAddressL2 = tA['WAGMIv3'].L2.toLowerCase()
+ } else if (_tokenContractAddressL1 === 'wagmiv3') {
+ _tokenContractAddressL2 = tA['WAGMIv3']?.L2?.toLowerCase()
tokenContract = new ethers.Contract(
_tokenContractAddressL2,
erc20abi,
- networkService.L2Provider,
+ networkService.L2Provider!
)
- }
- else if (_tokenContractAddressL1 === 'wagmiv3-oolong') {
- if(tA['WAGMIv3-Oolong'].L2 !== null) _tokenContractAddressL2 = tA['WAGMIv3-Oolong'].L2.toLowerCase()
+ } else if (_tokenContractAddressL1 === 'wagmiv3-oolong') {
+ _tokenContractAddressL2 = tA['WAGMIv3-Oolong']?.L2?.toLowerCase()
tokenContract = new ethers.Contract(
_tokenContractAddressL2,
erc20abi,
- networkService.L2Provider,
+ networkService.L2Provider!
)
- }
- else if (_tokenContractAddressL1 === 'olo') {
- if(tA['OLO'].L2 !== null) _tokenContractAddressL2 = tA['OLO'].L2.toLowerCase()
+ } else if (_tokenContractAddressL1 === 'olo') {
+ _tokenContractAddressL2 = tA['OLO']?.L2?.toLowerCase()
tokenContract = new ethers.Contract(
_tokenContractAddressL2,
erc20abi,
- networkService.L2Provider,
+ networkService.L2Provider!
)
} else {
Object.keys(tA).forEach((token, i) => {
//let's see if we know about this Token
- if(_tokenContractAddressL1 === tA[token].L1.toLowerCase()) {
- if( tA[token].L2 !== null)
- _tokenContractAddressL2 = tA[token].L2.toLowerCase()
+ if (_tokenContractAddressL1 === tA[token].L1.toLowerCase()) {
+ _tokenContractAddressL2 = tA[token]?.L2?.toLowerCase()
}
})
tokenContract = new ethers.Contract(
_tokenContractAddressL1,
erc20abi,
- networkService.L1Provider, //Everything is defined by the L1 address - will deal with the L2 address later
+ networkService.L1Provider! //Everything is defined by the L1 address - will deal with the L2 address later
)
}
@@ -163,71 +158,84 @@ export async function addToken ( tokenContractAddressL1 ) {
let _name
if (ethers.utils.isAddress(_tokenContractAddressL1)) {
- const tokenInfo = networkService.tokenInfo.L1[ethers.utils.getAddress(_tokenContractAddressL1)]
- if (tokenInfo) {
- _symbolL1 = tokenInfo.symbol
- _decimals = tokenInfo.decimals
- _name = tokenInfo.name
+ const tmpTokenInfo =
+ networkService.tokenInfo.L1[
+ ethers.utils.getAddress(_tokenContractAddressL1)
+ ]
+ if (tmpTokenInfo) {
+ _symbolL1 = tmpTokenInfo.symbol
+ _decimals = tmpTokenInfo.decimals
+ _name = tmpTokenInfo.name
}
}
if (!_symbolL1 || !_decimals || !_name) {
- [ _symbolL1, _decimals, _name ] = await Promise.all([
+ ;[_symbolL1, _decimals, _name] = await Promise.all([
tokenContract.symbol(),
tokenContract.decimals(),
- tokenContract.name()
- ]).catch(e => [ null, null, null ])
+ tokenContract.name(),
+ ]).catch((e) => [null, null, null])
}
- const decimals = _decimals ? Number(_decimals.toString()) : 'NOT ON ETHEREUM'
+ const decimals = _decimals
+ ? Number(_decimals.toString())
+ : 'NOT ON ETHEREUM'
const symbolL1 = _symbolL1 || 'NOT ON ETHEREUM'
const symbolL2 = _symbolL1 || 'NOT ON ETHEREUM'
const name = _name || 'NOT ON ETHEREUM'
//ETH is special as always
- if(_tokenContractAddressL1 === ETHL1 ) {
+ if (_tokenContractAddressL1 === ETHL1) {
_tokenContractAddressL2 = ETHL2
}
const tokenInfo = {
- currency: (
- _symbolL1 === 'xBOBA' ||
+ currency:
+ _symbolL1 === 'xBOBA' ||
_symbolL1 === 'WAGMIv0' ||
_symbolL1 === 'WAGMIv1' ||
_symbolL1 === 'WAGMIv2' ||
_symbolL1 === 'WAGMIv2-Oolong' ||
_symbolL1 === 'WAGMIv3' ||
_symbolL1 === 'WAGMIv3-Oolong'
- ) ? _tokenContractAddressL2 : _tokenContractAddressL1,
+ ? _tokenContractAddressL2!
+ : _tokenContractAddressL1,
addressL1: _tokenContractAddressL1,
- addressL2: _tokenContractAddressL2,
+ addressL2: _tokenContractAddressL2!,
symbolL1,
symbolL2,
decimals,
name,
- redalert: _decimals ? false : true
+ redalert: !_decimals,
}
store.dispatch({
type: 'TOKEN/GET/SUCCESS',
- payload: tokenInfo
- });
+ payload: tokenInfo,
+ })
return tokenInfo
-
} catch (error) {
-
store.dispatch({
type: 'TOKEN/GET/FAILURE',
- payload: {currency: _tokenContractAddressL1, L1address: _tokenContractAddressL1, L2address: '', symbol: 'Not found', error: 'Not found'},
+ payload: {
+ currency: _tokenContractAddressL1,
+ L1address: _tokenContractAddressL1,
+ L2address: '',
+ symbol: 'Not found',
+ error: 'Not found',
+ },
})
- return {currency: _tokenContractAddressL1, L1address: _tokenContractAddressL1, L2address: '', symbol: 'Not found', error: 'Not found'};
+ return {
+ currency: _tokenContractAddressL1,
+ L1address: _tokenContractAddressL1,
+ L2address: '',
+ symbol: 'Not found',
+ error: 'Not found',
+ }
}
}
-export function restTokenList () {
- return function (dispatch) {
- return dispatch({ type: 'TOKEN/GET/RESET' });
- }
-}
+export const restTokenList = () => (dispatch) =>
+ dispatch({ type: 'TOKEN/GET/RESET' })
diff --git a/src/actions/transactionAction.js b/src/actions/transactionAction.ts
similarity index 67%
rename from src/actions/transactionAction.js
rename to src/actions/transactionAction.ts
index a2e84cfe..794a92d1 100644
--- a/src/actions/transactionAction.js
+++ b/src/actions/transactionAction.ts
@@ -13,14 +13,5 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
-export function setCDMCompletion (payload) {
- return function (dispatch) {
- return dispatch({ type: 'CDM/COMPLETE/SET', payload });
- }
-}
-
-export function resetCDMCompletion () {
- return function (dispatch) {
- return dispatch({ type: 'CDM/COMPLETE/RESET' });
- }
-}
+export const resetCDMCompletion = () => (dispatch) =>
+ dispatch({ type: 'CDM/COMPLETE/RESET' })
diff --git a/src/actions/uiAction.js b/src/actions/uiAction.js
deleted file mode 100644
index e6d92653..00000000
--- a/src/actions/uiAction.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
-Copyright 2021-present Boba Network.
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License. */
-
-export function setTheme (theme) {
- return function (dispatch) {
- return dispatch({ type: 'UI/THEME/UPDATE', payload: theme });
- }
-}
-
-export function openModal (modal, token, fast, tokenIndex, lock, proposalId, selectionLayer, destNetworkSelection) {
- return function (dispatch) {
- return dispatch({ type: 'UI/MODAL/OPEN', payload: modal, token, fast, tokenIndex, lock, proposalId, selectionLayer, destNetworkSelection });
- }
-}
-
-export function closeModal (modal) {
- return function (dispatch) {
- return dispatch({ type: 'UI/MODAL/CLOSE', payload: modal });
- }
-}
-
-export function openAlert (message) {
- return function (dispatch) {
- return dispatch({ type: 'UI/ALERT/UPDATE', payload: message });
- }
-}
-
-export function closeAlert () {
- return function (dispatch) {
- return dispatch({ type: 'UI/ALERT/UPDATE', payload: null });
- }
-}
-
-export function openError (message) {
- return function (dispatch) {
- return dispatch({ type: 'UI/ERROR/UPDATE', payload: message });
- }
-}
-
-export function closeError () {
- return function (dispatch) {
- return dispatch({ type: 'UI/ERROR/UPDATE', payload: null });
- }
-}
-
-export function ledgerConnect (derivation) {
- return function (dispatch) {
- return dispatch({ type: 'UI/LEDGER/UPDATE', payload: derivation });
- }
-}
-
-export function setActiveHistoryTab (tab) {
- return function (dispatch) {
- return dispatch({ type: 'UI/HISTORYTAB/UPDATE', payload: tab });
- }
-}
-
-export function setActiveDataTab (tab) {
- return function (dispatch) {
- return dispatch({ type: 'UI/DATATAB/UPDATE', payload: tab });
- }
-}
-
-export function setModalData (modal, data) {
- return function (dispatch) {
- return dispatch({ type: 'UI/MODAL/DATA', payload: { modal, data } });
- }
-}
diff --git a/src/actions/uiAction.ts b/src/actions/uiAction.ts
new file mode 100644
index 00000000..df2a982b
--- /dev/null
+++ b/src/actions/uiAction.ts
@@ -0,0 +1,56 @@
+/*
+Copyright 2021-present Boba Network.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License. */
+
+export const setTheme = (theme) => (dispatch) =>
+ dispatch({ type: 'UI/THEME/UPDATE', payload: theme })
+
+export const openModal =
+ (
+ modal?,
+ token?,
+ fast?,
+ tokenIndex?,
+ lock?,
+ proposalId?,
+ selectionLayer?,
+ destNetworkSelection?
+ ) =>
+ (dispatch) =>
+ dispatch({
+ type: 'UI/MODAL/OPEN',
+ payload: modal,
+ token,
+ fast,
+ tokenIndex,
+ lock,
+ proposalId,
+ selectionLayer,
+ destNetworkSelection,
+ })
+
+export const closeModal = (modal) => (dispatch) =>
+ dispatch({ type: 'UI/MODAL/CLOSE', payload: modal })
+
+export const openAlert = (message) => (dispatch) =>
+ dispatch({ type: 'UI/ALERT/UPDATE', payload: message })
+
+export const closeAlert = () => (dispatch) =>
+ dispatch({ type: 'UI/ALERT/UPDATE', payload: null })
+
+export const openError = (message) => (dispatch) =>
+ dispatch({ type: 'UI/ERROR/UPDATE', payload: message })
+
+export const closeError = () => (dispatch) =>
+ dispatch({ type: 'UI/ERROR/UPDATE', payload: null })
diff --git a/src/actions/verifierAction.js b/src/actions/verifierAction.ts
similarity index 68%
rename from src/actions/verifierAction.js
rename to src/actions/verifierAction.ts
index a3c4509f..87f1f5e1 100644
--- a/src/actions/verifierAction.js
+++ b/src/actions/verifierAction.ts
@@ -14,14 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License. */
import verifierService from 'services/verifier.service'
-import {createAction} from './createAction'
+import { createAction } from './createAction'
-export function fetchVerifierStatus() {
- return createAction('VERIFIER/GET',() => verifierService.getVerifierStatus())
-}
+export const fetchVerifierStatus = () =>
+ createAction('VERIFIER/GET', () => verifierService.getVerifierStatus())
-export function resetVerifierStatus() {
- return function(dispatch) {
- return dispatch({type: 'VERIFIER/RESET'});
- }
-}
+export const resetVerifierStatus = () => (dispatch) =>
+ dispatch({ type: 'VERIFIER/RESET' })
diff --git a/src/api/coinGeckoAxios.js b/src/api/coinGeckoAxios.ts
similarity index 100%
rename from src/api/coinGeckoAxios.js
rename to src/api/coinGeckoAxios.ts
diff --git a/src/api/metaTransactionAxios.js b/src/api/metaTransactionAxios.ts
similarity index 74%
rename from src/api/metaTransactionAxios.js
rename to src/api/metaTransactionAxios.ts
index 9d6cfc23..a086e053 100644
--- a/src/api/metaTransactionAxios.js
+++ b/src/api/metaTransactionAxios.ts
@@ -1,9 +1,9 @@
import axios from 'axios'
-export default function metaTransactionAxiosInstance(networkConfig) {
+export default (networkConfig: any) => {
const url = networkConfig['META_TRANSACTION']
- let axiosInstance = axios.create({
+ const axiosInstance = axios.create({
baseURL: url,
})
diff --git a/src/api/omgxWatcherAxios.js b/src/api/omgxWatcherAxios.js
deleted file mode 100644
index 2255191c..00000000
--- a/src/api/omgxWatcherAxios.js
+++ /dev/null
@@ -1,17 +0,0 @@
-import axios from 'axios'
-
-export default function omgxWatcherAxiosInstance(networkConfig) {
- const watcherUrl = networkConfig[ 'OMGX_WATCHER_URL' ]
-
- let axiosInstance = axios.create({
- baseURL: watcherUrl,
- })
-
- axiosInstance.interceptors.request.use((config) => {
- config.headers[ 'Accept' ] = 'application/json'
- config.headers[ 'Content-Type' ] = 'application/json'
- return config
- })
-
- return axiosInstance
-}
diff --git a/src/api/omgxWatcherAxios.ts b/src/api/omgxWatcherAxios.ts
new file mode 100644
index 00000000..f09736d3
--- /dev/null
+++ b/src/api/omgxWatcherAxios.ts
@@ -0,0 +1,17 @@
+import axios from 'axios'
+
+export default (networkConfig) => {
+ const watcherUrl = networkConfig['OMGX_WATCHER_URL']
+
+ const axiosInstance = axios.create({
+ baseURL: watcherUrl,
+ })
+
+ axiosInstance.interceptors.request.use((config) => {
+ config.headers['Accept'] = 'application/json'
+ config.headers['Content-Type'] = 'application/json'
+ return config
+ })
+
+ return axiosInstance
+}
diff --git a/src/api/verifierWatcherAxios.js b/src/api/verifierWatcherAxios.js
deleted file mode 100644
index f6df944d..00000000
--- a/src/api/verifierWatcherAxios.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import axios from 'axios'
-
-export default function verifierWatcherAxiosInstance(networkConfig) {
- const url = networkConfig[ 'VERIFIER_WATCHER_URL' ]
-
- if (!url) {
- return null;
- }
-
- let axiosInstance = axios.create({
- baseURL: url
- })
-
- axiosInstance.interceptors.request.use((config) => {
- config.headers[ 'Accept' ] = 'application/json'
- config.headers[ 'Content-Type' ] = 'application/json'
- return config
- })
-
- return axiosInstance
-}
diff --git a/src/api/verifierWatcherAxios.ts b/src/api/verifierWatcherAxios.ts
new file mode 100644
index 00000000..fdde639c
--- /dev/null
+++ b/src/api/verifierWatcherAxios.ts
@@ -0,0 +1,21 @@
+import axios from 'axios'
+
+export default (networkConfig) => {
+ const url = networkConfig['VERIFIER_WATCHER_URL']
+
+ if (!url) {
+ return null
+ }
+
+ const axiosInstance = axios.create({
+ baseURL: url,
+ })
+
+ axiosInstance.interceptors.request.use((config) => {
+ config.headers['Accept'] = 'application/json'
+ config.headers['Content-Type'] = 'application/json'
+ return config
+ })
+
+ return axiosInstance
+}
diff --git a/src/components/bridge/ChainLabel/types.ts b/src/components/bridge/ChainLabel/types.ts
index 526c2eea..bf86b283 100644
--- a/src/components/bridge/ChainLabel/types.ts
+++ b/src/components/bridge/ChainLabel/types.ts
@@ -5,7 +5,6 @@ export interface ChainLabelInterface {
export type IconType = {
ethereum: ({ selected }: { selected?: boolean | undefined }) => Element
bnb: ({ selected }: { selected?: boolean | undefined }) => Element
- avax: ({ selected }: { selected?: boolean | undefined }) => Element
}
export type DirectionType = {
diff --git a/src/components/button/Button.js b/src/components/button/Button.tsx
similarity index 85%
rename from src/components/button/Button.js
rename to src/components/button/Button.tsx
index d8dcd6bb..e88a2f83 100644
--- a/src/components/button/Button.js
+++ b/src/components/button/Button.tsx
@@ -14,11 +14,25 @@ See the License for the specific language governing permissions and
limitations under the License. */
import React from 'react'
-import { CircularProgress } from '@mui/material'
-import { Button as ButtonMUI } from '@mui/material'
+import { CircularProgress, Button as ButtonMUI } from '@mui/material'
import Tooltip from '../tooltip/Tooltip'
-function Button({
+interface IButtonProps {
+ children
+ style
+ onClick
+ color
+ variant
+ fullWidth
+ disabled: boolean
+ loading: boolean
+ sx
+ tooltip: string
+ size
+ triggerTime: Date
+}
+
+const Button = ({
children,
style,
onClick,
@@ -28,14 +42,10 @@ function Button({
disabled,
loading,
sx,
- pulsate,
tooltip = '',
size,
- className,
- triggerTime
-}) {
- if (disabled || loading) pulsate = false
-
+ triggerTime,
+}: IButtonProps) => {
let timeDefined = false
if (typeof triggerTime !== 'undefined') {
timeDefined = true
@@ -55,8 +65,11 @@ function Button({
}
}, [loading])
+ // @ts-ignore
let waitTime = (now - triggerTime) / 1000
- if (waitTime < 0) waitTime = 0
+ if (waitTime < 0) {
+ waitTime = 0
+ }
waitTime = Math.round(waitTime)
const muiProps = {
diff --git a/src/components/icons/AlertIcon.js b/src/components/icons/AlertIcon.js
deleted file mode 100644
index 55aa4da5..00000000
--- a/src/components/icons/AlertIcon.js
+++ /dev/null
@@ -1,24 +0,0 @@
-import * as React from "react";
-import { useTheme } from "@mui/material/styles";
-
-function AlertIcon() {
- const theme = useTheme();
- const color = theme.palette.primary.alert;
- return (
-
- );
-}
-
-export default AlertIcon;
-
-
diff --git a/src/components/icons/AlertIcon.tsx b/src/components/icons/AlertIcon.tsx
new file mode 100644
index 00000000..befb2355
--- /dev/null
+++ b/src/components/icons/AlertIcon.tsx
@@ -0,0 +1,26 @@
+import * as React from 'react'
+import { useTheme } from '@mui/material/styles'
+
+const AlertIcon = () => {
+ const theme = useTheme()
+ const color = (theme.palette.primary as any).alert
+ return (
+
+ )
+}
+
+export default AlertIcon
diff --git a/src/components/icons/Boba2Icon.js b/src/components/icons/Boba2Icon.js
deleted file mode 100644
index 364ded00..00000000
--- a/src/components/icons/Boba2Icon.js
+++ /dev/null
@@ -1,48 +0,0 @@
-import * as React from "react"
-import { useTheme } from '@mui/material';
-
-function Boba2Icon({ dark = false, selected = true }) {
-
- const theme = useTheme();
-
- const recColor = theme.palette.mode === 'light' ? '#031313' : '#ffffff'
-
- if (!selected) {
- return
- }
-
- if (theme.palette.mode === 'dark') {
- return (
-
- )
- }
-
- return (
-
- )
-}
-
-export default Boba2Icon
diff --git a/src/components/icons/Boba2Icon.tsx b/src/components/icons/Boba2Icon.tsx
new file mode 100644
index 00000000..4aee8b66
--- /dev/null
+++ b/src/components/icons/Boba2Icon.tsx
@@ -0,0 +1,142 @@
+import * as React from 'react'
+import { useTheme } from '@mui/material'
+
+const Boba2Icon = ({ selected = true }) => {
+ const theme = useTheme()
+
+ const recColor = theme.palette.mode === 'light' ? '#031313' : '#ffffff'
+
+ if (!selected) {
+ return (
+
+ )
+ }
+
+ if (theme.palette.mode === 'dark') {
+ return (
+
+ )
+ }
+
+ return (
+
+ )
+}
+
+export default Boba2Icon
diff --git a/src/components/icons/BobaGlassIcon.js b/src/components/icons/BobaGlassIcon.js
deleted file mode 100644
index c94345f2..00000000
--- a/src/components/icons/BobaGlassIcon.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import * as React from "react"
-
-function BobaGlassIcon() {
-
- return (
-
- )
-}
-
-export default BobaGlassIcon
diff --git a/src/components/icons/BobaGlassIcon.tsx b/src/components/icons/BobaGlassIcon.tsx
new file mode 100644
index 00000000..af7cda01
--- /dev/null
+++ b/src/components/icons/BobaGlassIcon.tsx
@@ -0,0 +1,31 @@
+import * as React from 'react'
+
+const BobaGlassIcon = () => (
+
+)
+
+export default BobaGlassIcon
diff --git a/src/components/icons/BobaLogo.js b/src/components/icons/BobaLogo.js
deleted file mode 100644
index 5fa24431..00000000
--- a/src/components/icons/BobaLogo.js
+++ /dev/null
@@ -1,21 +0,0 @@
-import * as React from "react"
-import { useTheme } from '@mui/material';
-import { ReactComponent as LogoBoba2 } from 'assets/images/boba2/logo-boba2.svg';
-import {ReactComponent as LogoBoba2dark} from 'assets/images/boba2/logo-boba2-dark.svg';
-
-function BobaLogo() {
-
- const theme = useTheme();
-
- if (theme.palette.mode === 'dark') {
- return (
-
- )
- }
-
- return (
-
- )
-}
-
-export default BobaLogo
diff --git a/src/components/icons/BobaLogo.tsx b/src/components/icons/BobaLogo.tsx
new file mode 100644
index 00000000..945e2c06
--- /dev/null
+++ b/src/components/icons/BobaLogo.tsx
@@ -0,0 +1,16 @@
+import * as React from 'react'
+import { useTheme } from '@mui/material'
+import { ReactComponent as LogoBoba2 } from 'assets/images/boba2/logo-boba2.svg'
+import { ReactComponent as LogoBoba2dark } from 'assets/images/boba2/logo-boba2-dark.svg'
+
+const BobaLogo = () => {
+ const theme = useTheme()
+
+ if (theme.palette.mode === 'dark') {
+ return
+ }
+
+ return
+}
+
+export default BobaLogo
diff --git a/src/components/icons/CalenderIcon.js b/src/components/icons/CalenderIcon.js
deleted file mode 100644
index 20cd086d..00000000
--- a/src/components/icons/CalenderIcon.js
+++ /dev/null
@@ -1,18 +0,0 @@
-import * as React from "react";
-import { useTheme } from "@mui/material/styles";
-
-function CalenderIcon() {
- const theme = useTheme();
- const isLight = theme.palette.mode === 'light';
- const color = theme.palette.common[ isLight ? 'black' : 'white' ];
- return (
-
- );
-}
-
-export default CalenderIcon;
diff --git a/src/components/icons/CalenderIcon.tsx b/src/components/icons/CalenderIcon.tsx
new file mode 100644
index 00000000..f6cda775
--- /dev/null
+++ b/src/components/icons/CalenderIcon.tsx
@@ -0,0 +1,25 @@
+import * as React from 'react'
+import { useTheme } from '@mui/material/styles'
+
+const CalenderIcon = () => {
+ const theme = useTheme()
+ const isLight = theme.palette.mode === 'light'
+ const color = theme.palette.common[isLight ? 'black' : 'white']
+ return (
+
+ )
+}
+
+export default CalenderIcon
diff --git a/src/components/icons/DarkIcon.js b/src/components/icons/DarkIcon.tsx
similarity index 83%
rename from src/components/icons/DarkIcon.js
rename to src/components/icons/DarkIcon.tsx
index 3192c88b..f34fd6b8 100644
--- a/src/components/icons/DarkIcon.js
+++ b/src/components/icons/DarkIcon.tsx
@@ -1,10 +1,10 @@
-import * as React from "react";
-import { useTheme } from "@mui/material/styles";
+import * as React from 'react'
+import { useTheme } from '@mui/material/styles'
-function DarkIcon() {
- const theme = useTheme();
- const isLight = theme.palette.mode === 'light';
- const color = theme.palette.common[isLight ? 'black' : 'white'];
+const DarkIcon = () => {
+ const theme = useTheme()
+ const isLight = theme.palette.mode === 'light'
+ const color = theme.palette.common[isLight ? 'black' : 'white']
return (