Skip to content

Commit

Permalink
feat: refresh claims after wait, locales
Browse files Browse the repository at this point in the history
  • Loading branch information
toniocodo committed Jul 24, 2024
1 parent 15ad061 commit 6892951
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 18 deletions.
20 changes: 14 additions & 6 deletions apps/defi/src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -577,12 +577,6 @@
"value": "Amount to Stake"
}
],
"7+beT+": [
{
"type": 0,
"value": "~30 min - few days"
}
],
"7CPiAt": [
{
"type": 0,
Expand Down Expand Up @@ -667,6 +661,20 @@
"value": "Redeem for mix via Origin Vault"
}
],
"8g703D": [
{
"type": 0,
"value": "~"
},
{
"type": 1,
"value": "WITHDRAW_DELAY"
},
{
"type": 0,
"value": " min - few days"
}
],
"8nvhZ9": [
{
"type": 0,
Expand Down
6 changes: 3 additions & 3 deletions apps/defi/src/lang/extracts/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,6 @@
"6fzXU+": {
"defaultMessage": "Amount to Stake"
},
"7+beT+": {
"defaultMessage": "~30 min - few days"
},
"7CPiAt": {
"defaultMessage": "Redeemed"
},
Expand Down Expand Up @@ -272,6 +269,9 @@
"8cCxx8": {
"defaultMessage": "Redeem for mix via Origin Vault"
},
"8g703D": {
"defaultMessage": "~{WITHDRAW_DELAY} min - few days"
},
"8nvhZ9": {
"defaultMessage": "Last"
},
Expand Down
10 changes: 2 additions & 8 deletions libs/defi/oeth/src/redeem/components/ClaimHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,12 @@ export const ClaimHeader = (props: StackProps) => {
);
const availableToClaim =
claimable?.reduce(
(acc, curr) =>
curr.claimable
? add([curr.amount, tokens.mainnet.WETH.decimals], acc)
: acc,
(acc, curr) => add([curr.amount, tokens.mainnet.WETH.decimals], acc),
from(0),
) ?? from(0);
const pendingAmount =
pending?.reduce(
(acc, curr) =>
curr.claimable
? add([curr.amount, tokens.mainnet.WETH.decimals], acc)
: acc,
(acc, curr) => add([curr.amount, tokens.mainnet.WETH.decimals], acc),
from(0),
) ?? from(0);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import { BlockExplorerLink } from '@origin/shared/providers';
import { getFormatPrecision, ZERO_ADDRESS } from '@origin/shared/utils';
import { useIntervalEffect, usePrevious } from '@react-hookz/web';
import { useQueryClient } from '@tanstack/react-query';
import { format } from 'dnum';
import { useIntl } from 'react-intl';
import { useAccount } from 'wagmi';
Expand Down Expand Up @@ -58,6 +59,7 @@ export const WithdrawalRequestModal = ({
const theme = useTheme();
const fullScreen = useMediaQuery(theme.breakpoints.down('md'));
const { update } = useViewSelect();
const queryClient = useQueryClient();
const { address } = useAccount();
const [status, setStatus] = useState<Status>('processing');
const [retries, setRetries] = useState(0);
Expand Down Expand Up @@ -207,6 +209,9 @@ export const WithdrawalRequestModal = ({
fullWidth
onClick={() => {
update('claim');
queryClient.invalidateQueries({
queryKey: ['useClaimableRequests', address],
});
onClose?.({}, 'backdropClick');
}}
size="large"
Expand Down
2 changes: 1 addition & 1 deletion libs/defi/oeth/src/redeem/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export const useWithdrawalRequests = (
new Date(r.timestamp),
addMinutes(
fromUnixTime(Number(block?.timestamp ?? 0)),
WITHDRAW_DELAY,
WITHDRAW_DELAY + 1,
),
);

Expand Down

0 comments on commit 6892951

Please sign in to comment.