Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rename notify calls
Browse files Browse the repository at this point in the history
DanielSchiavini committed Jan 29, 2025
1 parent 923b2e5 commit 65d8813
Showing 40 changed files with 150 additions and 150 deletions.
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ import FieldLockedAmt from '@/dao/components/PageVeCrv/components/FieldLockedAmt
import Stepper from '@ui/Stepper'
import TxInfoBar from '@ui/TxInfoBar'
import { CurveApi } from '@/dao/types/dao.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const FormLockCreate = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) => {
const isSubscribed = useRef(false)
@@ -100,7 +100,7 @@ const FormLockCreate = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) =>
const handleBtnClickApproval = useCallback(
async (activeKey: string, curve: CurveApi, formValues: FormValues) => {
const notifyMessage = t`Please approve spending your CRV.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
await fetchStepApprove(activeKey, curve, rFormType, formValues)
if (typeof dismiss === 'function') dismiss()
},
@@ -112,7 +112,7 @@ const FormLockCreate = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) =>
if (formValues.utcDate) {
const localUtcDate = formValues.calcdUtcDate || formatDisplayDate(formValues.utcDate.toString())
const notifyMessage = t`Please confirm locking ${formatNumber(formValues.lockedAmt)} CRV until ${localUtcDate}.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepCreate(activeKey, curve, formValues)

if (isSubscribed.current && resp && resp.hash && resp.activeKey === activeKey) {
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ import FieldLockedAmt from '@/dao/components/PageVeCrv/components/FieldLockedAmt
import Stepper from '@ui/Stepper'
import TxInfoBar from '@ui/TxInfoBar'
import { CurveApi } from '@/dao/types/dao.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const FormLockCrv = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) => {
const isSubscribed = useRef(false)
@@ -51,7 +51,7 @@ const FormLockCrv = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) => {
const handleBtnClickApproval = useCallback(
async (activeKey: string, curve: CurveApi, formValues: FormValues) => {
const notifyMessage = t`Please approve spending your CRV.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
await fetchStepApprove(activeKey, curve, rFormType, formValues)
if (typeof dismiss === 'function') dismiss()
},
@@ -61,7 +61,7 @@ const FormLockCrv = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) => {
const handleBtnClickIncrease = useCallback(
async (activeKey: string, curve: CurveApi, formValues: FormValues) => {
const notifyMessage = t`Please confirm increasing lock amount by ${formValues.lockedAmt} CRV.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepIncreaseCrv(activeKey, curve, formValues)

if (isSubscribed.current && resp && resp.hash && resp.activeKey === activeKey) {
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import FieldDatePicker from '@/dao/components/PageVeCrv/components/FieldDatePick
import Stepper from '@ui/Stepper'
import TxInfoBar from '@ui/TxInfoBar'
import { CurveApi } from '@/dao/types/dao.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const FormLockDate = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) => {
const isSubscribed = useRef(false)
@@ -116,7 +116,7 @@ const FormLockDate = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) => {
if (formValues.utcDate) {
const localUtcDate = formValues.calcdUtcDate || formatDisplayDate(formValues.utcDate.toString())
const notifyMessage = t`Please confirm changing unlock date to ${localUtcDate}.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepIncreaseTime(activeKey, curve, formValues)

if (isSubscribed.current && resp && resp.hash && resp.activeKey === activeKey) {
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ import ExternalLink from '@ui/Link/ExternalLink'
import Icon from '@ui/Icon'
import TxInfoBar from '@ui/TxInfoBar'
import { ChainId, CurveApi, Provider } from '@/dex/types/main.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const Compensation = ({
rChainId,
@@ -56,7 +56,7 @@ const Compensation = ({
async (activeKey: string, contract: EtherContract['contract'], balance: number) => {
if (!curve) return
const notifyMessage = t`Please confirm claim ${balance} compensation.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')

try {
setStep('claiming')
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ import FieldLockedAmt from '@/dex/components/PageCrvLocker/components/FieldLocke
import Stepper from '@ui/Stepper'
import TxInfoBar from '@ui/TxInfoBar'
import { CurveApi } from '@/dex/types/main.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const FormLockCreate = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) => {
const isSubscribed = useRef(false)
@@ -96,7 +96,7 @@ const FormLockCreate = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) =>
const handleBtnClickApproval = useCallback(
async (activeKey: string, curve: CurveApi, formValues: FormValues) => {
const notifyMessage = t`Please approve spending your CRV.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
await fetchStepApprove(activeKey, curve, rFormType, formValues)
if (typeof dismiss === 'function') dismiss()
},
@@ -108,7 +108,7 @@ const FormLockCreate = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) =>
if (formValues.utcDate) {
const localUtcDate = formValues.calcdUtcDate || formatDisplayDate(formValues.utcDate.toString())
const notifyMessage = t`Please confirm locking ${formatNumber(formValues.lockedAmt)} CRV until ${localUtcDate}.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepCreate(activeKey, curve, formValues)

if (isSubscribed.current && resp && resp.hash && resp.activeKey === activeKey) {
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ import FieldLockedAmt from '@/dex/components/PageCrvLocker/components/FieldLocke
import Stepper from '@ui/Stepper'
import TxInfoBar from '@ui/TxInfoBar'
import { CurveApi } from '@/dex/types/main.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const FormLockCrv = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) => {
const isSubscribed = useRef(false)
@@ -48,7 +48,7 @@ const FormLockCrv = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) => {
const handleBtnClickApproval = useCallback(
async (activeKey: string, curve: CurveApi, formValues: FormValues) => {
const notifyMessage = t`Please approve spending your CRV.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
await fetchStepApprove(activeKey, curve, rFormType, formValues)
if (typeof dismiss === 'function') dismiss()
},
@@ -58,7 +58,7 @@ const FormLockCrv = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) => {
const handleBtnClickIncrease = useCallback(
async (activeKey: string, curve: CurveApi, formValues: FormValues) => {
const notifyMessage = t`Please confirm increasing lock amount by ${formValues.lockedAmt} CRV.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepIncreaseCrv(activeKey, curve, formValues)

if (isSubscribed.current && resp && resp.hash && resp.activeKey === activeKey) {
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@ import FieldDatePicker from '@/dex/components/PageCrvLocker/components/FieldDate
import Stepper from '@ui/Stepper'
import TxInfoBar from '@ui/TxInfoBar'
import { CurveApi } from '@/dex/types/main.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const FormLockDate = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) => {
const isSubscribed = useRef(false)
@@ -112,7 +112,7 @@ const FormLockDate = ({ curve, rChainId, rFormType, vecrvInfo }: PageVecrv) => {
if (formValues.utcDate) {
const localUtcDate = formValues.calcdUtcDate || formatDisplayDate(formValues.utcDate.toString())
const notifyMessage = t`Please confirm changing unlock date to ${localUtcDate}.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepIncreaseTime(activeKey, curve, formValues)

if (isSubscribed.current && resp && resp.hash && resp.activeKey === activeKey) {
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ import useStore from '@/dex/store/useStore'
import Button from '@ui/Button'
import Stepper from '@ui/Stepper'
import TxInfoBar from '@ui/TxInfoBar'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const FormClaimFeesButtons = ({
activeKey,
@@ -61,7 +61,7 @@ const FormClaimFeesButtons = ({

const { scanTxPath } = network
const notifyMessage = t`Please approve claim veCRV rewards.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')

// loading state
setClaimingKey(key)
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import Button from '@ui/Button'
import Stepper from '@ui/Stepper'
import TxInfoBar from '@ui/TxInfoBar'
import { CurveApi } from '@/dex/types/main.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

// TODO uncomment locker link code once it is ready
const FormVecrv = () => {
@@ -61,7 +61,7 @@ const FormVecrv = () => {
const handleBtnClickWithdraw = useCallback(
async (activeKey: string, curve: CurveApi, lockedAmount: string) => {
const notifyMessage = t`Please confirm withdraw of ${lockedAmount} CRV.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepWithdraw(activeKey, curve, walletAddress)

if (isSubscribed.current && resp && resp.hash && resp.walletAddress === walletAddress && network) {
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ import Stepper from '@ui/Stepper'
import TransferActions from '@/dex/components/PagePool/components/TransferActions'
import TxInfoBar from '@ui/TxInfoBar'
import { CurveApi, PoolData } from '@/dex/types/main.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const FormDeposit = ({
chainIdPoolId,
@@ -86,7 +86,7 @@ const FormDeposit = ({
const handleApproveClick = useCallback(
async (activeKey: string, curve: CurveApi, poolData: PoolData, formValues: FormValues) => {
const notifyMessage = t`Please approve spending your ${tokensDescription(formValues.amounts)}.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
await fetchStepApprove(activeKey, curve, 'DEPOSIT', poolData.pool, formValues)
if (typeof dismiss === 'function') dismiss()
},
@@ -97,7 +97,7 @@ const FormDeposit = ({
async (activeKey: string, curve: CurveApi, poolData: PoolData, formValues: FormValues, maxSlippage: string) => {
const tokenText = amountsDescription(formValues.amounts)
const notifyMessage = t`Please confirm deposit of ${tokenText} at max ${maxSlippage}% slippage.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepDeposit(activeKey, curve, poolData, formValues, maxSlippage)

if (isSubscribed.current && resp && resp.hash && resp.activeKey === activeKey && network) {
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import Stepper from '@ui/Stepper'
import TransferActions from '@/dex/components/PagePool/components/TransferActions'
import TxInfoBar from '@ui/TxInfoBar'
import { CurveApi, Pool, PoolData } from '@/dex/types/main.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const FormDepositStake = ({
chainIdPoolId,
@@ -89,7 +89,7 @@ const FormDepositStake = ({
const handleApproveClick = useCallback(
async (activeKey: string, curve: CurveApi, pool: Pool, formValues: FormValues) => {
const notifyMessage = t`Please approve spending your ${tokensDescription(formValues.amounts)}.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
await fetchStepApprove(activeKey, curve, 'DEPOSIT_STAKE', pool, formValues)
if (typeof dismiss === 'function') dismiss()
},
@@ -100,7 +100,7 @@ const FormDepositStake = ({
async (activeKey: string, curve: CurveApi, poolData: PoolData, formValues: FormValues, maxSlippage: string) => {
const tokenText = amountsDescription(formValues.amounts)
const notifyMessage = t`Please confirm deposit and staking of ${tokenText} LP Tokens at max ${maxSlippage}% slippage.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepDepositStake(activeKey, curve, poolData, formValues, maxSlippage)

if (isSubscribed.current && resp && resp.hash && resp.activeKey === activeKey) {
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ import Stepper from '@ui/Stepper'
import TransferActions from '@/dex/components/PagePool/components/TransferActions'
import TxInfoBar from '@ui/TxInfoBar'
import { CurveApi, Pool, PoolData } from '@/dex/types/main.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const FormStake = ({ curve, poolData, poolDataCacheOrApi, routerParams, seed, userPoolBalances }: TransferProps) => {
const isSubscribed = useRef(false)
@@ -55,7 +55,7 @@ const FormStake = ({ curve, poolData, poolDataCacheOrApi, routerParams, seed, us
const handleApproveClick = useCallback(
async (activeKey: string, curve: CurveApi, pool: Pool, formValues: FormValues) => {
const notifyMessage = t`Please approve spending your LP Tokens.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
await fetchStepApprove(activeKey, curve, 'STAKE', pool, formValues)
if (typeof dismiss === 'function') dismiss()
},
@@ -65,7 +65,7 @@ const FormStake = ({ curve, poolData, poolDataCacheOrApi, routerParams, seed, us
const handleStakeClick = useCallback(
async (activeKey: string, curve: CurveApi, poolData: PoolData, formValues: FormValues) => {
const notifyMessage = t`Please confirm staking of ${formValues.lpToken} LP Tokens`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepStake(activeKey, curve, poolData, formValues)

if (isSubscribed.current && resp && resp.hash && resp.activeKey === activeKey && network) {
6 changes: 3 additions & 3 deletions apps/main/src/dex/components/PagePool/Swap/index.tsx
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ import TransferActions from '@/dex/components/PagePool/components/TransferAction
import TxInfoBar from '@ui/TxInfoBar'
import WarningModal from '@/dex/components/PagePool/components/WarningModal'
import { Balances, CurveApi, PoolAlert, PoolData, TokensMapper } from '@/dex/types/main.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const Swap = ({
chainIdPoolId,
@@ -126,7 +126,7 @@ const Swap = ({
) => {
const { fromAmount, fromToken, toToken } = formValues
const notifyMessage = t`Please confirm swap ${fromAmount} ${fromToken} for ${toToken} at max slippage ${maxSlippage}%.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepSwap(actionActiveKey, curve, poolData, formValues, maxSlippage)

if (isSubscribed.current && resp && resp.hash && resp.activeKey === activeKey && network) {
@@ -179,7 +179,7 @@ const Swap = ({
content: isApprove ? t`Spending Approved` : t`Approve Spending`,
onClick: async () => {
const notifyMessage = t`Please approve spending your ${formValues.fromToken}.`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
await fetchStepApprove(actionActiveKey, curve, poolData.pool, formValues, maxSlippage)
if (typeof dismiss === 'function') dismiss()
},
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ import Stepper from '@ui/Stepper'
import TransferActions from '@/dex/components/PagePool/components/TransferActions'
import TxInfoBar from '@ui/TxInfoBar'
import { CurveApi, PoolData } from '@/dex/types/main.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const FormClaim = ({ curve, poolData, poolDataCacheOrApi, routerParams, seed, userPoolBalances }: TransferProps) => {
const isSubscribed = useRef(false)
@@ -60,7 +60,7 @@ const FormClaim = ({ curve, poolData, poolDataCacheOrApi, routerParams, seed, us
rewardsNeedNudging: boolean | undefined,
) => {
const notifyMessage = getClaimText(formValues, formStatus, 'notify', rewardsNeedNudging)
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepClaim(activeKey, curve, poolData)

if (isSubscribed.current && resp && resp.hash && resp.activeKey === activeKey && network) {
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ import TransferActions from '@/dex/components/PagePool/components/TransferAction
import Stepper from '@ui/Stepper'
import TxInfoBar from '@ui/TxInfoBar'
import { CurveApi, PoolData } from '@/dex/types/main.types'
import { notify as notifyNotification } from '@ui-kit/features/connect-wallet'
import { notify } from '@ui-kit/features/connect-wallet'

const FormUnstake = ({ curve, poolData, poolDataCacheOrApi, routerParams, seed, userPoolBalances }: TransferProps) => {
const isSubscribed = useRef(false)
@@ -47,7 +47,7 @@ const FormUnstake = ({ curve, poolData, poolDataCacheOrApi, routerParams, seed,
const handleUnstakeClick = useCallback(
async (activeKey: string, curve: CurveApi, poolData: PoolData, formValues: FormValues) => {
const notifyMessage = t`Please confirm unstaking of ${formValues.stakedLpToken} LP Tokens`
const { dismiss } = notifyNotification(notifyMessage, 'pending')
const { dismiss } = notify(notifyMessage, 'pending')
const resp = await fetchStepUnstake(activeKey, curve, poolData, formValues)

if (isSubscribed.current && resp && resp.hash && resp.activeKey === activeKey && network) {
Loading

0 comments on commit 65d8813

Please sign in to comment.