Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
vkulinich-cl committed Jul 1, 2024
1 parent 62a27b2 commit 9aff43f
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 37 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"@galacticcouncil/xcm-cfg": "^2.8.0",
"@galacticcouncil/xcm-core": "^1.7.0",
"@galacticcouncil/xcm-sdk": "^3.5.0",
"@moonbeam-network/xcm-utils": "2.1.1",
"@lit-labs/react": "^1.1.0",
"@moonbeam-network/xcm-utils": "2.1.1",
"@polkadot/api": "11.2.1",
"@polkadot/apps-config": "^0.132.1",
"@polkadot/extension-inject": "^0.44.5",
Expand Down Expand Up @@ -84,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
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/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
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
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12454,10 +12454,10 @@ typescript@^4.4.3, typescript@^4.7.4:
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==

typescript@^5.4.2:
version "5.5.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.2.tgz#c26f023cb0054e657ce04f72583ea2d85f8d0507"
integrity sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==
typescript@~5.2.2:
version "5.2.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.2.2.tgz#5ebb5e5a5b75f085f22bc3f8460fba308310fa78"
integrity sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==

ua-parser-js@^1.0.35:
version "1.0.38"
Expand Down

0 comments on commit 9aff43f

Please sign in to comment.