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] Kintsugi 2.9.5 #1127

Merged
merged 24 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
fc0f79f
chore: add resolutions for various polkadot packages (#1089)
bvotteler Mar 30, 2023
b7e3540
Fix input field width issue (#1090)
Chanakya888 Mar 31, 2023
65ac49a
chore: bump XCM bridge (#1093)
tomjeatt Apr 3, 2023
7dd557e
feat(Wallet): add page (#1001)
danielsimao Apr 4, 2023
0cdaf10
Tom/bug/burn form collateral tokens (#1042)
tomjeatt Apr 4, 2023
d837dcf
Add CORS to market data (#1096)
tomjeatt Apr 4, 2023
5704ba3
fix: revert to using 0.2.x version of the bridge (#1095)
tomjeatt Apr 4, 2023
ad02c4b
chore: improve price impact warning copy
tomjeatt Apr 5, 2023
1b98be0
Merge pull request #1101 from interlay/tom/update-slippage-copy
nud3l Apr 5, 2023
fee27c1
chore: release v2.29.0
tomjeatt Apr 5, 2023
eb5f34d
fix(amm): use correct hooks dependencies (#1105)
peterslany Apr 6, 2023
6f3927f
fix: update useGetCurrencies callbacks dependency arrays (#1108)
peterslany Apr 6, 2023
f4c32f6
chore: release v2.29.1
tomjeatt Apr 6, 2023
bc68075
[wallet] improve wallet balance (#1109)
tomjeatt Apr 11, 2023
c03d338
chore: release v2.29.2
tomjeatt Apr 11, 2023
2caf2b4
refactor: use current block when calculating lock time extension (#1118)
tomjeatt Apr 11, 2023
fa8842b
Tom/hotfix/use correct xcm names (#1119)
tomjeatt Apr 11, 2023
b84186e
chore: release v2.29.3
tomjeatt Apr 11, 2023
3851b38
fix: correct apy calculation (#1123)
tomjeatt Apr 12, 2023
8a2ab31
chore: release v2.29.4
tomjeatt Apr 12, 2023
00ca099
Merge branch 'master' into tom/release/kintsugi/2.9.4
tomjeatt Apr 12, 2023
6478c0e
fix: prevent rewards estimate from being called when user has insuffi…
tomjeatt Apr 12, 2023
a988931
chore: release v2.29.5
tomjeatt Apr 12, 2023
c1a65b4
Merge branch 'master' into tom/release/kintsugi/2.9.5
tomjeatt Apr 12, 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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "interbtc-ui",
"version": "2.29.3",
"version": "2.29.5",
"private": true,
"dependencies": {
"@craco/craco": "^6.1.1",
Expand Down
17 changes: 13 additions & 4 deletions src/pages/Staking/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ interface LockingAmountAndTime {

const Staking = (): JSX.Element => {
const [blockLockTimeExtension, setBlockLockTimeExtension] = React.useState<number>(0);
const [calculateRewards, setCalculateRewards] = React.useState<boolean>(false);

const dispatch = useDispatch();
const { t } = useTranslation();
Expand Down Expand Up @@ -190,7 +191,7 @@ const Staking = (): JSX.Element => {
[GENERIC_FETCHER, 'escrow', 'getRewardEstimate', selectedAccountAddress],
genericFetcher<EstimatedRewardAmountAndAPY>(),
{
enabled: !!bridgeLoaded
enabled: !!bridgeLoaded && calculateRewards
}
);
useErrorHandler(rewardAmountAndAPYError);
Expand All @@ -213,7 +214,7 @@ const Staking = (): JSX.Element => {
],
genericFetcher<EstimatedRewardAmountAndAPY>(),
{
enabled: !!bridgeLoaded
enabled: !!bridgeLoaded && calculateRewards
}
);
useErrorHandler(estimatedRewardAmountAndAPYError);
Expand Down Expand Up @@ -320,10 +321,14 @@ const Staking = (): JSX.Element => {
React.useEffect(() => {
if (!lockTime) return;
if (!currentBlockNumber) return;
if (!stakedAmountAndEndBlock) return;

const lockTimeValue = Number(lockTime);
setBlockLockTimeExtension(currentBlockNumber + convertWeeksToBlockNumbers(lockTimeValue));
}, [currentBlockNumber, lockTime]);
const extensionTime =
stakedAmountAndEndBlock.endBlock + currentBlockNumber + convertWeeksToBlockNumbers(lockTimeValue);

setBlockLockTimeExtension(extensionTime);
}, [currentBlockNumber, lockTime, stakedAmountAndEndBlock]);

React.useEffect(() => {
reset({
Expand Down Expand Up @@ -421,6 +426,8 @@ const Staking = (): JSX.Element => {
};

const validateLockingAmount = (value: string): string | undefined => {
setCalculateRewards(false);

const valueWithFallback = value || '0';
const monetaryLockingAmount = newMonetaryAmount(valueWithFallback, GOVERNANCE_TOKEN, true);

Expand All @@ -435,6 +442,8 @@ const Staking = (): JSX.Element => {
return 'Locking amount must not be greater than available balance!';
}

setCalculateRewards(true);

const planckLockingAmount = monetaryLockingAmount.toBig(0);
const lockBlocks = convertWeeksToBlockNumbers(parseInt(lockTime));
// This is related to the on-chain implementation where currency values are integers.
Expand Down