Skip to content

Commit

Permalink
Merge pull request #2106 from galacticcouncil/rococo
Browse files Browse the repository at this point in the history
Rococo => prod
  • Loading branch information
vkulinich-cl authored Feb 10, 2025
2 parents 7e95891 + 0013a40 commit f834a7d
Show file tree
Hide file tree
Showing 46 changed files with 841 additions and 434 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@polkadot/util": "^13.1.1",
"@polkadot/util-crypto": "^13.1.1",
"@polkadot/ui-shared": "^3.1.4",
"@galacticcouncil/xcm-core": "^6.1.1",
"@galacticcouncil/xcm-core": "^6.2.0",
"strip-ansi": "6.0.1",
"string-width": "4.2.2",
"wrap-ansi": "7.0.0",
Expand All @@ -38,7 +38,7 @@
"@emotion/styled": "^11.10.4",
"@ethersproject/address": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@galacticcouncil/apps": "^10.3.0",
"@galacticcouncil/apps": "^10.4.0",
"@galacticcouncil/math-lbp": "^1.0.0",
"@galacticcouncil/math-liquidity-mining": "^1.0.0",
"@galacticcouncil/math-omnipool": "^1.0.0",
Expand All @@ -47,9 +47,9 @@
"@galacticcouncil/math-xyk": "^1.0.0",
"@galacticcouncil/sdk": "^5.4.0",
"@galacticcouncil/ui": "^5.4.0",
"@galacticcouncil/xcm-cfg": "^7.3.0",
"@galacticcouncil/xcm-core": "^6.1.1",
"@galacticcouncil/xcm-sdk": "^8.1.1",
"@galacticcouncil/xcm-cfg": "^7.3.1",
"@galacticcouncil/xcm-core": "^6.2.0",
"@galacticcouncil/xcm-sdk": "^8.2.0",
"@hookform/resolvers": "^3.3.4",
"@lit-labs/react": "^1.1.0",
"@polkadot/api": "14.0.1",
Expand Down
15 changes: 14 additions & 1 deletion src/api/democracy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
PalletReferendaReferendumStatus,
PalletReferendaCurve,
PalletConvictionVotingVoteAccountVote,
PalletReferendaReferendumInfo,
} from "@polkadot/types/lookup"
import BN, { BigNumber } from "bignumber.js"
import { BN_0 } from "utils/constants"
Expand Down Expand Up @@ -225,7 +226,19 @@ export const useOpenGovUnlockedTokens = () => {
classId: vote.classId,
}
} else {
const endBlock = referendum.asApproved[0].toBigNumber()
const referendaType = referendum.type.toString() as Exclude<
PalletReferendaReferendumInfo["type"],
"Ongoing"
>

let endBlock

if (referendaType === "Killed") {
endBlock = referendum.asKilled.toBigNumber()
} else {
endBlock = referendum[`as${referendaType}`][0].toBigNumber()
}

const convictionBlock =
CONVICTIONS_BLOCKS[vote.conviction.toLocaleLowerCase()]

Expand Down
8 changes: 5 additions & 3 deletions src/api/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { OmniPoolToken } from "@galacticcouncil/sdk/build/types/pool/omni/OmniPo
import { millisecondsInMinute } from "date-fns"
import { TOmnipoolAssetsData } from "./omnipool"
import { HUB_ID } from "utils/api"
import { BN_NAN } from "utils/constants"

export const useShareOfPools = (assets: string[]) => {
const totalIssuances = useTotalIssuances()
Expand Down Expand Up @@ -123,11 +124,12 @@ export const useSDKPools = () => {
const getDynamicAssetFees =
(api: ApiPromise, assetId: string | u32) => async () => {
const res = await api.query.dynamicFees.assetFee(assetId)
const data = res.unwrap()

const data = res.unwrapOr(null)

return {
protocolFee: data.protocolFee.toBigNumber().div(10_000),
assetFee: data.assetFee.toBigNumber().div(10_000),
protocolFee: data?.protocolFee.toBigNumber().div(10_000) ?? BN_NAN,
assetFee: data?.assetFee.toBigNumber().div(10_000) ?? BN_NAN,
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/api/xcm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ export const useCrossChainWallet = () => {
// Register chain swaps
const hydration = configService.getChain("hydration")
const assethub = configService.getChain("assethub")
//const assethubCex = configService.getChain("assethub_cex")
const assethubCex = configService.getChain("assethub_cex")

wallet.registerDex(
new dex.HydrationDex(hydration, poolService),
new dex.AssethubDex(assethub),
//new dex.AssethubDex(assethubCex),
new dex.AssethubDex(assethubCex),
)

return wallet
Expand Down
1 change: 1 addition & 0 deletions src/assets/icons/CoinbaseWalletLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/icons/NightlyLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions src/assets/icons/RabbyWalletLogo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 7 additions & 1 deletion src/components/AssetSelect/AssetSelect.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,19 @@ export const SSelectAssetButton = styled(Button)`
padding: 6px 2px;
color: white;
:hover {
&:not(:disabled):hover {
border: unset;
margin-right: 20px;
cursor: pointer;
background: rgba(${theme.rgbColors.white}, 0.06);
}
&[disabled] {
cursor: not-allowed;
opacity: 0.2;
border: unset;
}
& > span {
min-width: 0;
}
Expand Down
9 changes: 8 additions & 1 deletion src/components/AssetSelect/AssetSelectButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@ type Props = {
onClick?: () => void
assetId: string
className?: string
disabled?: boolean
}

export const AssetSelectButton = ({ onClick, assetId, className }: Props) => {
export const AssetSelectButton = ({
onClick,
assetId,
className,
disabled,
}: Props) => {
const { t } = useTranslation()
const { getAsset } = useAssets()
const asset = getAsset(assetId)
Expand All @@ -31,6 +37,7 @@ export const AssetSelectButton = ({ onClick, assetId, className }: Props) => {
<SSelectAssetButton
className={className}
size="small"
disabled={disabled}
onClick={(e) => {
e.preventDefault()
onClick?.()
Expand Down
56 changes: 27 additions & 29 deletions src/components/Input/Input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,35 +39,33 @@ export const Input = forwardRef<HTMLInputElement, InputProps>(
ref,
) => {
return (
<>
<Label
label={label}
error={p.error}
withLabel={withLabel}
tooltip={tooltip}
id={name}
>
<SWrapper unit={p.unit}>
{iconStart}
<SInput
ref={ref}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
onChange(e.target.value)
}
value={value ?? ""}
id={name}
type={type}
error={p.error}
unit={p.unit}
placeholder={placeholder}
role="presentation"
autoComplete="off"
{...p}
/>
{iconEnd}
</SWrapper>
</Label>
</>
<Label
label={label}
error={p.error}
withLabel={withLabel}
tooltip={tooltip}
id={name}
>
<SWrapper unit={p.unit}>
{iconStart}
<SInput
ref={ref}
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
onChange(e.target.value)
}
value={value ?? ""}
id={name}
type={type}
error={p.error}
unit={p.unit}
placeholder={placeholder}
role="presentation"
autoComplete="off"
{...p}
/>
{iconEnd}
</SWrapper>
</Label>
)
},
)
12 changes: 10 additions & 2 deletions src/i18n/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"details": "Details",
"manage": "Manage",
"close": "Close",
"edit": "Edit",
"submit": "Submit",
"continue": "Continue",
"transfer": "Transfer",
Expand Down Expand Up @@ -251,8 +252,9 @@
"liquidity.stablepool.asset.incentives.title": "Farming incentives",
"liquidity.stablepool.reserves": "Stable reserves",
"liquidity.stablepool.transfer.options": "Add Liquidity",
"liquidity.stablepool.transfer.omnipool": "Omnipool",
"liquidity.stablepool.transfer.stablepool": "Stablepool",
"liquidity.stablepool.transfer.addLiquidity": "Add liquidity",
"liquidity.stablepool.transfer.addLiquidity.joinFarms": "Add liquidity and join farms",
"liquidity.stablepool.transfer.stablepool": "Add liquidity to stablepool",
"liquidity.stablepool.position.title": "Your share tokens",
"liquidity.stablepool.position.amount": "Amount available",
"liquidity.stablepool.position.token": "share tokens",
Expand Down Expand Up @@ -293,6 +295,10 @@
"liquidity.asset.capacity.full": "<0>Asset cap reached:</0> <1>{{ filled, compact }} / {{ capacity, compact }} {{ symbol }}</1>",
"liquidity.add.modal.button.joinFarms": "Add liquidity & Join Farms",
"liquidity.add.modal.title": "Add liquidity",
"liquidity.add.modal.limit.title": "Add Liquidity Limit",
"liquidity.add.modal.limit.description1": "Here you can control the maximum allowed deviation between your desired price for adding liquidity and the actual execution price.",
"liquidity.add.modal.limit.description2": "Such deviation can be caused by price changes due to trading activity.",
"liquidity.add.modal.limit.validation.max": "Max value is {{value}}",
"liquidity.add.modal.provideLiquidity": "Provide Liquidity",
"liquidity.add.modal.provideLiquidity.loading": "Providing liquidity",
"liquidity.add.modal.row.transactionCostValue": "≈ {{ amount, bignumber }} {{ symbol }}",
Expand All @@ -302,6 +308,7 @@
"liquidity.add.modal.joinFarms": "Join available farms",
"liquidity.add.modal.joinFarms.description": "Disable this option if you don't want to enter the farms.",
"liquidity.add.modal.poolTradeFee": "Pool trade fee:",
"liquidity.add.modal.tradeLimit": "Trade limit:",
"liquidity.add.modal.tradeFee": "Rewards from fees:",
"liquidity.add.modal.tradeFee.description": "These rewards will be distributed between all liquidity providers.",
"liquidity.add.modal.shareTokens": "Received amount of share tokens",
Expand All @@ -322,6 +329,7 @@
"liquidity.add.modal.xyk.toast.onSuccess": "<0>Added liquidity in exchange for </0><1>{{shares, bignumber(type: 'token')}}</1><0> asset shares.</0>",
"liquidity.remove.modal.title": "Remove liquidity",
"liquidity.remove.modal.value": "{{ value, bignumber(type: 'token') }}",
"liquidity.remove.modal.split": "Remove assets proportionally",
"liquidity.remove.modal.receive": "You will receive:",
"liquidity.remove.modal.price": "Price:",
"liquidity.remove.modal.shares": "{{ shares, bignumber(type: 'token') }} Shares",
Expand Down
18 changes: 17 additions & 1 deletion src/sections/pools/modals/AddLiquidity/AddLiquidity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import { AddLiquidityForm } from "./AddLiquidityForm"
import { isXYKPoolType } from "sections/pools/PoolsPage.utils"
import { AddLiquidityFormXYK } from "./AddLiquidityFormXYK"
import { usePoolData } from "sections/pools/pool/Pool"
import { LimitModal } from "./components/LimitModal/LimitModal"

export enum Page {
ADD_LIQUIDITY,
ASSET_SELECTOR,
LIMIT_LIQUIDITY,
}

type AddLiquidityProps = {
Expand All @@ -22,7 +24,7 @@ type AddLiquidityProps = {
export const AddLiquidity = ({ isOpen, onClose }: AddLiquidityProps) => {
const { pool } = usePoolData()
const { t } = useTranslation()
const { page, direction, back } = useModalPagination()
const { page, direction, back, paginateTo } = useModalPagination()
const [assetId, setAssetId] = useState(pool.id)

const farms = pool.farms
Expand All @@ -35,6 +37,11 @@ export const AddLiquidity = ({ isOpen, onClose }: AddLiquidityProps) => {
page={page}
direction={direction}
onClose={onClose}
onBack={
page === Page.LIMIT_LIQUIDITY
? () => paginateTo(Page.ADD_LIQUIDITY)
: undefined
}
contents={[
{
title: t("liquidity.add.modal.title"),
Expand All @@ -45,6 +52,7 @@ export const AddLiquidity = ({ isOpen, onClose }: AddLiquidityProps) => {
assetId={assetId}
farms={farms}
onClose={onClose}
setLiquidityLimit={() => paginateTo(Page.LIMIT_LIQUIDITY)}
/>
),
},
Expand All @@ -62,6 +70,14 @@ export const AddLiquidity = ({ isOpen, onClose }: AddLiquidityProps) => {
/>
),
},
{
title: t("liquidity.add.modal.limit.title"),
noPadding: true,
headerVariant: "GeistMono",
content: (
<LimitModal onConfirm={() => paginateTo(Page.ADD_LIQUIDITY)} />
),
},
]}
/>
</Modal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export const useAddLiquidity = (assetId: string, assetValue?: string) => {
omnipoolFee,
assetMeta: pool.meta,
assetBalance,
ommipoolAsset,
}
}

Expand Down
Loading

0 comments on commit f834a7d

Please sign in to comment.