Skip to content

Commit

Permalink
fix(app): balances type
Browse files Browse the repository at this point in the history
  • Loading branch information
cor committed Jun 8, 2024
1 parent 5fba4f7 commit bea4986
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/src/routes/transfer/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { onMount } from "svelte"
import { type Readable } from "svelte/store"
import { toast } from "svelte-sonner"
import { sepolia } from "viem/chains"
import { debounce } from "$lib/utilities"
Expand Down Expand Up @@ -137,8 +138,8 @@ $: {
}
// @ts-ignore
let sendableBalances = null;
let sendableBalances: null | Readable<Array<{balance: bigint, address: string, symbol: string, decimals: number}>> = null;
$: if (evmBalances !== null && cosmosBalances !== null && $cosmosChains !== null) {
sendableBalances = derived([queryParams, evmBalances, cosmosBalances], ([$queryParams, $evmBalances, $cosmosBalances]) => {
const fromChain = $queryParams["from-chain-id"];
Expand All @@ -152,11 +153,11 @@ $: if (evmBalances !== null && cosmosBalances !== null && $cosmosChains !== nul
const chainIndex = $cosmosChains.findIndex(c => c.chain_id === fromChain);
const cosmosBalance = $cosmosBalances[chainIndex]
if (!cosmosBalance.isSuccess) {
if (!cosmosBalance.isSuccess || cosmosBalance.data instanceof Error) {
alert('trying to send from evm but no balances fetched yet');
return [];
}
return cosmosBalance.data
return cosmosBalance.data.map((balance) => ({ ...balance, balance: BigInt(balance.balance)}))
});
}
Expand Down

0 comments on commit bea4986

Please sign in to comment.