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

[release] Interlay 2.40.1 #1603

Merged
merged 47 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
6aaa38c
Merge pull request #838 from interlay/pre-api-1.20
tomjeatt Jan 23, 2023
0774a8a
Merge pull request #984 from interlay/tom/hotfix/vault-collateral-error
tomjeatt Feb 24, 2023
c95841a
chore: change discord link
peterslany Feb 27, 2023
9621805
Merge pull request #989 from interlay/peter/interlay-chore-discord-link
tomjeatt Feb 27, 2023
f63171d
fix: hotfix price fetcher
tomjeatt Mar 29, 2023
45b6b71
Merge pull request #1088 from interlay/tom/hotfix/interlay/price-fetcher
tomjeatt Mar 29, 2023
c17dfcb
Release/interlay/2.29.0 (#1094)
tomjeatt Apr 5, 2023
cdd7c40
Release/interlay/2.29.1 (#1106)
tomjeatt Apr 6, 2023
ad52679
hotfix: bump bridge and enable Hydra XCM (#1112)
tomjeatt Apr 11, 2023
cf2f0bf
Tom/release/interlay/2.9.3 (#1120)
tomjeatt Apr 11, 2023
14d74b3
[release] Interlay 2.9.5 (#1128)
tomjeatt Apr 12, 2023
a697114
fix: revert change which blocks rewards calculation
tomjeatt Apr 13, 2023
5cae189
Merge branch 'master' into tom/release/interlay/2.29.6-release
tomjeatt Apr 14, 2023
6b97096
Merge branch 'tom/fix/revert-staking-changes' into tom/release/interl…
tomjeatt Apr 14, 2023
ed7d620
Merge pull request #1133 from interlay/tom/release/interlay/2.29.6-re…
tomjeatt Apr 14, 2023
2fbf2c3
Merge branch 'master' into tom/release/interlay/2.30.1
tomjeatt Apr 25, 2023
77b821c
Merge pull request #1151 from interlay/tom/release/interlay/2.30.1
tomjeatt Apr 26, 2023
8957b39
Merge branch 'master' into tom/release/interlay/2.30.2
tomjeatt Apr 27, 2023
e247793
Merge pull request #1163 from interlay/tom/release/interlay/2.30.2
tomjeatt Apr 27, 2023
e6b27c4
Merge branch 'master' into tom/release/interlay/2.30.5
tomjeatt Apr 28, 2023
7946c63
chore: release v2.30.5
tomjeatt Apr 28, 2023
77d7e79
Merge branch 'master' into tom/release/interlay/2.30.5
tomjeatt Apr 28, 2023
0f17fea
Merge pull request #1172 from interlay/tom/release/interlay/2.30.5
tomjeatt Apr 28, 2023
825a80f
Merge branch 'master' into tom/release/interlay/2.31.2
tomjeatt May 18, 2023
edb090a
Merge pull request #1208 from interlay/tom/release/interlay/2.31.2
tomjeatt May 18, 2023
369cd26
Merge branch 'master' into tom/release/interlay/2.31.3
tomjeatt May 18, 2023
b4ad444
Merge pull request #1211 from interlay/tom/release/interlay/2.31.3
tomjeatt May 18, 2023
cd21b8c
[release] Interlay 2.32.4 (#1231)
tomjeatt May 25, 2023
ec672e9
[release] Interlay 2.32.5 (#1235)
tomjeatt May 26, 2023
85ebf9c
[release] Interlay 2.32.6 (#1248)
tomjeatt May 31, 2023
3b9bd2a
fix: trigger build with updated squid
nud3l Jun 21, 2023
e1a4532
[release] Interlay 2.34.0 (#1312)
tomjeatt Jun 21, 2023
f378ec4
[release] Interlay 2.34.1 (#1327)
tomjeatt Jun 22, 2023
a8ae8ce
[release] Interlay 2.35.6 (#1415)
tomjeatt Jul 5, 2023
d22e708
hotfix: multiply input amount by 10 until byof trading path is found …
peterslany Jul 5, 2023
bf56478
[release] Interlay 2.35.8 (#1431)
tomjeatt Jul 7, 2023
ec0444c
[Release] Interlay 2.36.0 (#1471)
tomjeatt Jul 19, 2023
1021024
[Release] Interlay 2.36.1 (#1474)
tomjeatt Jul 20, 2023
3ea693e
[release] Interlay 2.37.0 (#1510)
tomjeatt Aug 7, 2023
afecdcc
[release] Interlay 2.38.1 (#1567)
tomjeatt Sep 26, 2023
5503e5d
[release] Interlay 2.38.2 (#1574)
tomjeatt Sep 28, 2023
95d956e
[release] Interlay 2.39.0 (#1583)
tomjeatt Oct 2, 2023
8e9d89e
[release] Interlay 2.39.1 (#1586)
tomjeatt Oct 2, 2023
a1259f5
hotix: only show BTC transaction details to issuing account (#1588)
tomjeatt Oct 16, 2023
4ce60de
fix(Redeem): show premium redeem compensation (#1593)
danielsimao Oct 24, 2023
a1f4059
[release] Interlay 2.40.0 (#1597)
tomjeatt Nov 7, 2023
ea19900
Merge branch 'master' into release/interlay/2.40.1
tomjeatt Nov 16, 2023
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
37 changes: 37 additions & 0 deletions src/hooks/api/escrow/use-get-account-voting-balance.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { CurrencyExt } from '@interlay/interbtc-api';
import { MonetaryAmount } from '@interlay/monetary-js';
import { AccountId } from '@polkadot/types/interfaces';
import { useErrorHandler } from 'react-error-boundary';
import { useQuery } from 'react-query';

import { BLOCKTIME_REFETCH_INTERVAL } from '@/utils/constants/api';

import useAccountId from '../../use-account-id';

const getAccountVotingBalance = async (accountId: AccountId): Promise<MonetaryAmount<CurrencyExt>> =>
window.bridge.escrow.votingBalance(accountId);

interface GetAccountVotingBalanceResult {
data: MonetaryAmount<CurrencyExt> | undefined;
refetch: () => void;
}

const useGetAccountVotingBalance = (): GetAccountVotingBalanceResult => {
const accountId = useAccountId();

const queryKey = ['voting', accountId];

const { data, error, refetch } = useQuery({
queryKey,
queryFn: () => accountId && getAccountVotingBalance(accountId),
refetchInterval: BLOCKTIME_REFETCH_INTERVAL,
enabled: !!accountId
});

useErrorHandler(error);

return { data, refetch };
};

export { useGetAccountVotingBalance };
export type { GetAccountVotingBalanceResult };
48 changes: 48 additions & 0 deletions src/pages/Staking/ClaimRewardsButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import clsx from 'clsx';
import { useQueryClient } from 'react-query';

import { GOVERNANCE_TOKEN_SYMBOL } from '@/config/relay-chains';
import { Transaction, useTransaction } from '@/hooks/transaction';
import InterlayDenimOrKintsugiSupernovaContainedButton, {
Props as InterlayDenimOrKintsugiMidnightContainedButtonProps
} from '@/legacy-components/buttons/InterlayDenimOrKintsugiSupernovaContainedButton';
import { useSubstrateSecureState } from '@/lib/substrate';
import { GENERIC_FETCHER } from '@/services/fetchers/generic-fetcher';

interface CustomProps {
claimableRewardAmount: string;
}

const ClaimRewardsButton = ({
className,
claimableRewardAmount,
...rest
}: CustomProps & InterlayDenimOrKintsugiMidnightContainedButtonProps): JSX.Element => {
const { selectedAccount } = useSubstrateSecureState();

const queryClient = useQueryClient();

const transaction = useTransaction(Transaction.ESCROW_WITHDRAW_REWARDS, {
onSuccess: () => {
queryClient.invalidateQueries([GENERIC_FETCHER, 'escrow', 'getRewardEstimate', selectedAccount?.address]);
queryClient.invalidateQueries([GENERIC_FETCHER, 'escrow', 'getRewards', selectedAccount?.address]);
}
});

const handleClaimRewards = () => {
transaction.execute();
};

return (
<InterlayDenimOrKintsugiSupernovaContainedButton
className={clsx('w-full', 'px-6', 'py-3', 'text-base', 'rounded-md', className)}
onClick={handleClaimRewards}
pending={transaction.isLoading}
{...rest}
>
Claim {claimableRewardAmount} {GOVERNANCE_TOKEN_SYMBOL} Rewards
</InterlayDenimOrKintsugiSupernovaContainedButton>
);
};

export default ClaimRewardsButton;
83 changes: 83 additions & 0 deletions src/pages/Staking/WithdrawButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import clsx from 'clsx';
import { add, format } from 'date-fns';
import { useQueryClient } from 'react-query';

import { BLOCK_TIME } from '@/config/parachain';
import { GOVERNANCE_TOKEN_SYMBOL } from '@/config/relay-chains';
import { Transaction, useTransaction } from '@/hooks/transaction';
import InterlayDenimOrKintsugiSupernovaContainedButton, {
Props as InterlayDenimOrKintsugiMidnightContainedButtonProps
} from '@/legacy-components/buttons/InterlayDenimOrKintsugiSupernovaContainedButton';
import InformationTooltip from '@/legacy-components/tooltips/InformationTooltip';
import { useSubstrateSecureState } from '@/lib/substrate';
import { GENERIC_FETCHER } from '@/services/fetchers/generic-fetcher';
import { YEAR_MONTH_DAY_PATTERN } from '@/utils/constants/date-time';

const getFormattedUnlockDate = (remainingBlockNumbersToUnstake: number, formatPattern: string) => {
const unlockDate = add(new Date(), {
seconds: remainingBlockNumbersToUnstake * BLOCK_TIME
});

return format(unlockDate, formatPattern);
};

interface CustomProps {
stakedAmount: string;
remainingBlockNumbersToUnstake: number | undefined;
}

const WithdrawButton = ({
className,
stakedAmount,
remainingBlockNumbersToUnstake,
...rest
}: CustomProps & InterlayDenimOrKintsugiMidnightContainedButtonProps): JSX.Element => {
const { selectedAccount } = useSubstrateSecureState();

const transaction = useTransaction(Transaction.ESCROW_WITHDRAW, {
onSuccess: () => {
queryClient.invalidateQueries([GENERIC_FETCHER, 'escrow', 'getStakedBalance', selectedAccount?.address]);
}
});

const queryClient = useQueryClient();

const handleUnstake = () => transaction.execute();

const disabled = remainingBlockNumbersToUnstake ? remainingBlockNumbersToUnstake > 0 : false;

const renderUnlockDateLabel = () => {
return remainingBlockNumbersToUnstake === undefined
? '-'
: getFormattedUnlockDate(remainingBlockNumbersToUnstake, YEAR_MONTH_DAY_PATTERN);
};

const renderUnlockDateTimeLabel = () => {
return remainingBlockNumbersToUnstake === undefined
? '-'
: getFormattedUnlockDate(remainingBlockNumbersToUnstake, 'PPpp');
};

return (
<>
<InterlayDenimOrKintsugiSupernovaContainedButton
className={clsx('w-full', 'px-6', 'py-3', 'text-base', 'rounded-md', className)}
endIcon={
<InformationTooltip
// eslint-disable-next-line max-len
label={`You can unlock your staked ${stakedAmount} ${GOVERNANCE_TOKEN_SYMBOL} on ${renderUnlockDateTimeLabel()}`}
forDisabledAction={disabled}
/>
}
onClick={handleUnstake}
pending={transaction.isLoading}
disabled={disabled}
{...rest}
>
Withdraw Staked {GOVERNANCE_TOKEN_SYMBOL} {renderUnlockDateLabel()}
</InterlayDenimOrKintsugiSupernovaContainedButton>
</>
);
};

export default WithdrawButton;
Loading