Skip to content

Commit

Permalink
Merge pull request #477 from galacticcouncil/gc-apps
Browse files Browse the repository at this point in the history
upgrade to pjs 11.2.1
  • Loading branch information
jak-pan authored Jul 2, 2024
2 parents 11080b0 + a49ef67 commit d593394
Show file tree
Hide file tree
Showing 16 changed files with 5,531 additions and 4,783 deletions.
54 changes: 28 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,40 @@
"version": "0.1.0",
"private": true,
"resolutions": {
"@polkadot/api": "^10.9.1",
"@polkadot/api-augment": "10.9.1",
"@polkadot/api-derive": "10.9.1",
"@polkadot/api-base": "10.9.1",
"@polkadot/rpc-augment": "10.9.1",
"@polkadot/rpc-core": "10.9.1",
"@polkadot/rpc-provider": "10.9.1",
"@polkadot/types": "10.9.1",
"@polkadot/types-augment": "10.9.1",
"@polkadot/types-codec": "10.9.1",
"@polkadot/types-create": "10.9.1",
"@polkadot/types-known": "10.9.1",
"@polkadot/keyring": "^12.3.2",
"@polkadot/util": "^12.3.2",
"@polkadot/util-crypto": "^12.3.2",
"@polkadot/api": "11.2.1",
"@polkadot/api-augment": "11.2.1",
"@polkadot/api-derive": "11.2.1",
"@polkadot/api-base": "11.2.1",
"@polkadot/rpc-augment": "11.2.1",
"@polkadot/rpc-core": "11.2.1",
"@polkadot/rpc-provider": "11.2.1",
"@polkadot/types": "11.2.1",
"@polkadot/types-augment": "11.2.1",
"@polkadot/types-codec": "11.2.1",
"@polkadot/types-create": "11.2.1",
"@polkadot/types-known": "11.2.1",
"@polkadot/keyring": "^12.6.2",
"@polkadot/util": "^12.6.2",
"@polkadot/util-crypto": "^12.6.2",
"@polkadot/ui-shared": "^3.1.4"
},
"dependencies": {
"@basilisk/jsx": "link:./src/jsx",
"@emotion/is-prop-valid": "^1.2.0",
"@emotion/react": "^11.10.4",
"@emotion/styled": "^11.10.4",
"@galacticcouncil/api-augment": "^0.0.3",
"@galacticcouncil/apps": "3.3.3",
"@galacticcouncil/math-lbp": "^0.1.3",
"@galacticcouncil/math-liquidity-mining": "^0.1.3",
"@galacticcouncil/math-xyk": "^0.1.3",
"@galacticcouncil/sdk": "^1.1.11",
"@galacticcouncil/ui": "^3.1.2",
"@galacticcouncil/xcm-cfg": "^1.10.4",
"@galacticcouncil/xcm-sdk": "^2.3.1",
"@galacticcouncil/apps": "^4.3.1",
"@galacticcouncil/math-lbp": "^1.0.0",
"@galacticcouncil/math-liquidity-mining": "^1.0.0",
"@galacticcouncil/math-xyk": "^1.0.0",
"@galacticcouncil/sdk": "^3.1.0",
"@galacticcouncil/ui": "^4.1.0",
"@galacticcouncil/xcm-cfg": "^2.8.0",
"@galacticcouncil/xcm-core": "^1.7.0",
"@galacticcouncil/xcm-sdk": "^3.5.0",
"@lit-labs/react": "^1.1.0",
"@polkadot/api": "10.9.1",
"@moonbeam-network/xcm-utils": "2.1.1",
"@polkadot/api": "11.2.1",
"@polkadot/apps-config": "^0.132.1",
"@polkadot/extension-inject": "^0.44.5",
"@polkadot/ui-shared": "^3.1.4",
Expand Down Expand Up @@ -83,7 +84,7 @@
"react-remove-scroll": "^2.5.5",
"react-use": "^17.4.0",
"recharts": "^2.1.13",
"typescript": "^5.4.2",
"typescript": "~5.2.2",
"uuid": "^9.0.0",
"vite-plugin-wasm": "^2.1.0",
"web-vitals": "^2.1.4",
Expand Down Expand Up @@ -141,6 +142,7 @@
"@babel/plugin-transform-typescript": "^7.18.12",
"@babel/preset-typescript": "^7.18.6",
"@emotion/babel-plugin": "^11.10.2",
"@galacticcouncil/api-augment": "^0.1.0",
"@open-web3/orml-types": "^2.0.1",
"@storybook/addon-actions": "^7.0.0-beta.15",
"@storybook/addon-essentials": "^7.0.0-beta.15",
Expand Down
16 changes: 0 additions & 16 deletions patches/@polkadot+api-augment+10.9.1.patch

This file was deleted.

16 changes: 0 additions & 16 deletions patches/@polkadot+types-augment+10.9.1.patch

This file was deleted.

4 changes: 1 addition & 3 deletions src/api/accountBalances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ const getTokenAccountBalancesList =
let { data }: { data: PalletBalancesAccountDataCustom } =
natives[nativeIdx]

const frozen = data.feeFrozen
? data.feeFrozen.add(data.miscFrozen)
: data.frozen
const frozen = data.frozen

values.push({
free: data.free,
Expand Down
2 changes: 2 additions & 0 deletions src/api/assetDetails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const getAssetDetails = (api: ApiPromise) => async () => {
const assetsMeta = meta.map(([key, data]) => {
return {
id: key.args[0].toString(),
//@ts-ignore
symbol: data.unwrap().symbol.toUtf8(),
}
})
Expand All @@ -88,6 +89,7 @@ const getAssetDetails = (api: ApiPromise) => async () => {

return {
id: key.args[0].toString(),
//@ts-ignore
name: data.unwrap().name.toUtf8(),
assetType: data.unwrap().assetType.type,
existentialDeposit: data.unwrap().existentialDeposit.toBigNumber(),
Expand Down
3 changes: 3 additions & 0 deletions src/api/assetMeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ const getAllAssetMeta = (api: ApiPromise) => async () => {
entries.map(([key, data]) => {
return {
id: key.args[0].toString(),
//@ts-ignore
symbol: data.unwrap().symbol.toUtf8(),
//@ts-ignore
decimals: data.unwrap().decimals,
}
})
Expand Down Expand Up @@ -68,5 +70,6 @@ export const getAssetMeta = (api: ApiPromise, id: u32 | string) => async () => {
}

const res = await api.query.assetRegistry.assetMetadataMap(id)
//@ts-ignore
return { id, data: res.unwrapOr(null) }
}
20 changes: 3 additions & 17 deletions src/api/balances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,11 @@ export const getTokenBalance =
if (id.toString() === NATIVE_ASSET_ID) {
const res = (await api.query.system.account(account)) as any
const freeBalance = new BigNumber(res.data.free.toHex())
const miscFrozenBalance = new BigNumber(
res.data.miscFrozen
? res.data.miscFrozen.toHex()
: res.data.frozen.toHex(),
)
const feeFrozenBalance = new BigNumber(
res.data.feeFrozen
? res.data.feeFrozen.toHex()
: res.data.frozen.toHex(),
)

const frozenBalance = new BigNumber(res.data.frozen.toHex())
const reservedBalance = new BigNumber(res.data.reserved.toHex())

const balance = new BigNumber(
calculateFreeBalance(
freeBalance,
miscFrozenBalance,
feeFrozenBalance,
) ?? NaN,
)
const balance = new BigNumber(freeBalance).minus(frozenBalance)

return {
accountId: account,
Expand Down
2 changes: 1 addition & 1 deletion src/api/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { QUERY_KEYS } from "utils/queryKeys"
import { WsProvider } from "@polkadot/api"
import { create } from "zustand"
import { persist } from "zustand/middleware"
import { SubstrateApis } from "@galacticcouncil/xcm-sdk"
import { SubstrateApis } from "@galacticcouncil/xcm-core"
import { PoolService, PoolType, TradeRouter } from "@galacticcouncil/sdk"

const fetchApi = async (url: string) => {
Expand Down
11 changes: 10 additions & 1 deletion src/components/AppProviders/AppProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ import { Provider as TooltipProvider } from "@radix-ui/react-tooltip"
import { SkeletonTheme } from "react-loading-skeleton"
import { theme } from "theme"
import { WalletConnectProvider } from "components/WalletConnectProvider/WalletConnectProvider"
import * as React from "react"
import * as Apps from "@galacticcouncil/apps"
import { createComponent } from "@lit-labs/react"

const AppsContextProvider = createComponent({
tagName: "gc-context-provider",
elementClass: Apps.ContextProvider,
react: React,
})

export const AppProviders: FC<PropsWithChildren> = ({ children }) => {
const preference = useProviderRpcUrlStore()
Expand All @@ -30,7 +39,7 @@ export const AppProviders: FC<PropsWithChildren> = ({ children }) => {
highlightColor={`rgba(${theme.rgbColors.white}, 0.24)`}
borderRadius={9999}
>
{children}
<AppsContextProvider>{children}</AppsContextProvider>
<Transactions />
</SkeletonTheme>
</ToastProvider>
Expand Down
2 changes: 1 addition & 1 deletion src/components/AssetIcon/AssetIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const UigcAssetPlaceholder = createComponent({
react: React,
})

export function getAssetLogo(symbol: string | null | undefined) {
export function getAssetLogo(symbol: string | undefined) {
return (
<UigcAssetLogo
ref={(el) => el && el.setAttribute("fit", "")}
Expand Down
2 changes: 1 addition & 1 deletion src/sections/provider/ProviderSelectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { connectWsProvider } from "./ProviderSelectModal.utils"
import { ProviderInput } from "./components/ProviderInput/ProviderInput"
import { Separator } from "components/Separator/Separator"
import { DeleteModal } from "./components/DeleteModal/DeleteModal"
import { SubstrateApis } from "@galacticcouncil/xcm-sdk"
import { SubstrateApis } from "@galacticcouncil/xcm-core"

export function ProviderSelectModal(props: {
open: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useEffect, useState } from "react"
import { WsProvider } from "@polkadot/rpc-provider"
import { u32, u64 } from "@polkadot/types"
import { ProviderItemEdit } from "../ProviderItemEdit/ProviderItemEdit"
import { SubstrateApis } from "@galacticcouncil/xcm-sdk"
import { SubstrateApis } from "@galacticcouncil/xcm-core"

const ProviderItemExternal = (props: { url: string; className?: string }) => {
const [bestNumberState, setBestNumberState] = useState<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,19 +279,11 @@ const getNativeBalances = (
const free = balance.free.toBigNumber()
const reservedBN = balance.reserved.toBigNumber()

const feeFrozen = balance.feeFrozen
? balance.feeFrozen.toBigNumber()
: //@ts-ignore
balance.frozen.toBigNumber()

const miscFrozen = balance.miscFrozen
? balance.miscFrozen.toBigNumber()
: //@ts-ignore
balance.frozen.toBigNumber()
const frozen = balance.frozen.toBigNumber()

const total = free.plus(reservedBN).div(dp)
const totalUSD = total.times(spotPrice)
const transferable = free.minus(BN.max(feeFrozen, miscFrozen)).div(dp)
const transferable = free.minus(frozen).div(dp)
const transferableUSD = transferable.times(spotPrice)

const reserved = reservedBN.div(dp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const useLiquidityPositionsTableData = () => {
: []

const assetsPool = useAssetDetailsList(tokenIds, {
//@ts-ignore
assetType: ["PoolShare"],
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,18 +88,16 @@ export const SWalletButton = styled.button<{
`
}
if (variant === "external") {
return css`
background: hsla(360, 100%, 100%, 0.05);
return css`
background: hsla(360, 100%, 100%, 0.05);
:hover {
background: hsla(360, 100%, 100%, 0.1);
}
:hover {
background: hsla(360, 100%, 100%, 0.1);
}
:active {
background: hsla(360, 100%, 100%, 0.12);
}
`
}
:active {
background: hsla(360, 100%, 100%, 0.12);
}
`
}}
`
Loading

0 comments on commit d593394

Please sign in to comment.