From e3ec4f2d59a24b1e91f3b598591b0414dfd16b8b Mon Sep 17 00:00:00 2001 From: Lukas Date: Thu, 9 Jan 2025 19:27:38 +0100 Subject: [PATCH] chore(app): pre commit --- app/src/lib/queries/balance/index.ts | 40 ++++++++++++++-------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/app/src/lib/queries/balance/index.ts b/app/src/lib/queries/balance/index.ts index c3f7915659..85ad73c2fe 100644 --- a/app/src/lib/queries/balance/index.ts +++ b/app/src/lib/queries/balance/index.ts @@ -1,13 +1,13 @@ -import {derived, get, type Readable} from "svelte/store" -import {bech32ToBech32Address} from "@unionlabs/client" -import {type Address, isAddress} from "viem" -import type {Chain, ChainAsset, UserAddresses} from "$lib/types" -import {erc20ReadMulticall} from "./evm/multicall.ts" -import {getCosmosChainBalances} from "./cosmos.ts" -import {getAptosChainBalances} from "./aptos.ts" -import {createQueries} from "@tanstack/svelte-query" -import type {QueryObserverResult} from "@tanstack/query-core" -import {balanceStore} from "$lib/components/TransferFrom/transfer/balances.ts" +import { derived, get, type Readable } from "svelte/store" +import { bech32ToBech32Address } from "@unionlabs/client" +import { type Address, isAddress } from "viem" +import type { Chain, ChainAsset, UserAddresses } from "$lib/types" +import { erc20ReadMulticall } from "./evm/multicall.ts" +import { getCosmosChainBalances } from "./cosmos.ts" +import { getAptosChainBalances } from "./aptos.ts" +import { createQueries } from "@tanstack/svelte-query" +import type { QueryObserverResult } from "@tanstack/query-core" +import { balanceStore } from "$lib/components/TransferFrom/transfer/balances.ts" export type AssetMetadata = { denom: string @@ -103,8 +103,8 @@ export async function getUserBalances( const contractAddresses = denoms ? denoms.filter((denom): denom is Address => isAddress(denom)).map(normalizeAddress) : chain.assets - .filter((asset): asset is ChainAsset & { denom: Address } => isAddress(asset.denom)) - .map(asset => normalizeAddress(asset.denom)) + .filter((asset): asset is ChainAsset & { denom: Address } => isAddress(asset.denom)) + .map(asset => normalizeAddress(asset.denom)) const results = await erc20ReadMulticall({ chainId: chain.chain_id, @@ -226,7 +226,7 @@ export function allChainBalances(chains: Array, addressStore: Readable { @@ -249,9 +249,7 @@ export function allChainBalances(chains: Array, addressStore: Readable { - const enriched = balances.find( - b => b.metadata.denom === placeholder.metadata.denom - ) + const enriched = balances.find(b => b.metadata.denom === placeholder.metadata.denom) return enriched || placeholder }) @@ -268,7 +266,10 @@ export function allChainBalances(chains: Array, addressStore: Readable { @@ -282,7 +283,6 @@ export function allChainBalances(chains: Array, addressStore: Readable, addressStore: Readable { const hasAddress = chains.some(chain => getAddressForChain(chain, $addresses)) if (!hasAddress) { - lastData = Array(chains.length).fill([]) + lastData = new Array(chains.length).fill([]) balanceStore.set(lastData) } return $chainStores }) -} \ No newline at end of file +}