diff --git a/package.json b/package.json index 86af86297..6aac15586 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/modules/farming/pages/item/helpers.ts b/src/modules/farming/pages/item/helpers.ts index 10fdaf406..1e6da1052 100644 --- a/src/modules/farming/pages/item/helpers.ts +++ b/src/modules/farming/pages/item/helpers.ts @@ -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, knownBakers: WhitelistedBaker[]) => { + if (typeof delegateAddress === 'object' && delegateAddress != null && 'Some' in delegateAddress) { + delegateAddress = unpackOption(delegateAddress); + } -export const makeBaker = (delegateAddress: Optional, knownBakers: WhitelistedBaker[]) => { if (typeof delegateAddress === 'string' && delegateAddress !== ZERO_ADDRESS) { return knownBakers.find(({ address }) => address === delegateAddress) ?? { address: delegateAddress }; } diff --git a/src/modules/liquidity/pages/cpmm-item/components/dex-two-details/use-dex-two-pool-current-baker.ts b/src/modules/liquidity/pages/cpmm-item/components/dex-two-details/use-dex-two-pool-current-baker.ts index ec4d1f0a5..4d76b540d 100644 --- a/src/modules/liquidity/pages/cpmm-item/components/dex-two-details/use-dex-two-pool-current-baker.ts +++ b/src/modules/liquidity/pages/cpmm-item/components/dex-two-details/use-dex-two-pool-current-baker.ts @@ -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 }; }; diff --git a/src/modules/voting/helpers/get-candidate-info.ts b/src/modules/voting/helpers/get-candidate-info.ts index 2e81ee33b..93fac3574 100644 --- a/src/modules/voting/helpers/get-candidate-info.ts +++ b/src/modules/voting/helpers/get-candidate-info.ts @@ -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; secondCandidate: Nullable; @@ -14,7 +14,13 @@ export const getCandidateInfo = (dex: Nullable, bakers: Array; + current_candidate: Option; + }; + + const current_delegated = unpackOption(_current_delegated)!; + const current_candidate = unpackOption(_current_candidate)!; const emptyCurrentDelegated = { address: current_delegated }; const emptyCurrentCandidate = { address: current_candidate };