Skip to content

Commit

Permalink
Merge pull request #1387 from madfish-solutions/v3.4.3
Browse files Browse the repository at this point in the history
V3.4.3
  • Loading branch information
Digberi authored Jan 5, 2024
2 parents 21fb5fc + 287e99c commit f4aaff6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quipuswap-webapp-2",
"version": "3.4.2",
"version": "3.4.3",
"private": true,
"scripts": {
"pre-build": "node -v && npm -v && yarn -v && node ./scripts/build.js",
Expand Down
10 changes: 7 additions & 3 deletions src/modules/farming/pages/item/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import { ZERO_ADDRESS } from '@config/constants';
import { FarmingItemV1Model } from '@modules/farming/models';
import { isTezosToken } from '@shared/helpers';
import { Optional, WhitelistedBaker } from '@shared/types';
import { isTezosToken, unpackOption } from '@shared/helpers';
import { Option, WhitelistedBaker } from '@shared/types';

export const makeBaker = (delegateAddress: Option<string> | string, knownBakers: WhitelistedBaker[]) => {
if (typeof delegateAddress === 'object' && delegateAddress != null && 'Some' in delegateAddress) {
delegateAddress = unpackOption(delegateAddress);
}

export const makeBaker = (delegateAddress: Optional<string>, knownBakers: WhitelistedBaker[]) => {
if (typeof delegateAddress === 'string' && delegateAddress !== ZERO_ADDRESS) {
return knownBakers.find(({ address }) => address === delegateAddress) ?? { address: delegateAddress };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const useDexTwoPoolCurrentBaker = () => {
const error = errorData ? new Error(errorData) : null;

return {
currentBaker: { data: makeBaker(bakerAddress, bakers), loading: bakersLoading || bakerAddressLoading, error },
currentBaker: { data: makeBaker(bakerAddress!, bakers), loading: bakersLoading || bakerAddressLoading, error },
canHaveBaker
};
};
12 changes: 9 additions & 3 deletions src/modules/voting/helpers/get-candidate-info.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FoundDex } from '@quipuswap/sdk';

import { Nullable, WhitelistedBaker } from '@shared/types';

import { unpackOption } from '@shared/helpers';
import { Nullable, WhitelistedBaker, Option } from '@shared/types';
export interface CandidateInfo {
currentCandidate: Nullable<WhitelistedBaker>;
secondCandidate: Nullable<WhitelistedBaker>;
Expand All @@ -14,7 +14,13 @@ export const getCandidateInfo = (dex: Nullable<FoundDex>, bakers: Array<Whitelis
secondCandidate: null
};
}
const { current_delegated, current_candidate } = dex.storage.storage;
const { current_delegated: _current_delegated, current_candidate: _current_candidate } = dex.storage.storage as {
current_delegated: Option<string>;
current_candidate: Option<string>;
};

const current_delegated = unpackOption(_current_delegated)!;
const current_candidate = unpackOption(_current_candidate)!;

const emptyCurrentDelegated = { address: current_delegated };
const emptyCurrentCandidate = { address: current_candidate };
Expand Down

1 comment on commit f4aaff6

@vercel
Copy link

@vercel vercel bot commented on f4aaff6 Jan 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.