Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Actions now typed #168

Merged
merged 3 commits into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 0 additions & 91 deletions src/actions/balanceAction.js

This file was deleted.

90 changes: 90 additions & 0 deletions src/actions/balanceAction.ts
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/

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()
)
123 changes: 0 additions & 123 deletions src/actions/bridgeAction.js

This file was deleted.

82 changes: 82 additions & 0 deletions src/actions/bridgeAction.ts
Original file line number Diff line number Diff line change
@@ -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 })
}
Loading