Skip to content

Commit

Permalink
fix(app): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
cor committed Jun 8, 2024
1 parent df90ebb commit b480f95
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 137 deletions.
35 changes: 17 additions & 18 deletions app/src/routes/explorer/transfers/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
<script lang="ts">
import request from "graphql-request"
import { allTransfersQueryDocument} from "$lib/graphql/documents/transfers.ts"
import { createQuery } from "@tanstack/svelte-query"
import { URLS } from "$lib/constants"
import Table from "../(components)/table.svelte"
import { flexRender, type ColumnDef } from "@tanstack/svelte-table"
import { derived, writable } from "svelte/store"
import CellStatus from "../(components)/cell-status.svelte"
import { DurationUnits } from "svelte-ux"
import CellDurationText from "../(components)/cell-duration-text.svelte"
import request from "graphql-request"
import { allTransfersQueryDocument } from "$lib/graphql/documents/transfers.ts"
import { createQuery } from "@tanstack/svelte-query"
import { URLS } from "$lib/constants"
import Table from "../(components)/table.svelte"
import { flexRender, type ColumnDef } from "@tanstack/svelte-table"
import { derived, writable } from "svelte/store"
import CellStatus from "../(components)/cell-status.svelte"
import { DurationUnits } from "svelte-ux"
import CellDurationText from "../(components)/cell-duration-text.svelte"
let transfers = createQuery ({
queryKey: ["transfers"],
refetchInterval: 1_000,
queryFn: async () => (await request(URLS.GRAPHQL, allTransfersQueryDocument, {})).v0_transfers
})
let transfers = createQuery({
queryKey: ["transfers"],
refetchInterval: 1_000,
queryFn: async () => (await request(URLS.GRAPHQL, allTransfersQueryDocument, {})).v0_transfers
})
let transfersData = derived(transfers, ($transfers) => $transfers.isSuccess ? $transfers.data : []);
let transfersData = derived(transfers, $transfers => ($transfers.isSuccess ? $transfers.data : []))
const columns: Array<ColumnDef<{ chain_id: string }>> = [
const columns: Array<ColumnDef<{ chain_id: string }>> = [
{
accessorKey: "source_chain_id",
header: () => "Source Chain",
Expand Down
6 changes: 3 additions & 3 deletions app/src/routes/transfer/(components)/chain-dialog.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import * as Dialog from "$lib/components/ui/dialog"
import { Input } from "$lib/components/ui/input/index.js"
import { Button } from "$lib/components/ui/button/index.js"
import type { LooseAutocomplete } from "$lib/utilities/types.ts"
import type { Writable } from "svelte/store";
import type { Writable } from "svelte/store"
export let kind: "from" | "to"
export let dialogOpen = false
export let onChainSelect: (newSelectedChain: string) => void
export let chains: Array<{ chain_id: string;}>
export let selectedChain: string;
export let chains: Array<{ chain_id: string }>
export let selectedChain: string
$: document.body.style.overflow = dialogOpen ? "hidden" : "auto"
</script>
Expand Down
62 changes: 3 additions & 59 deletions app/src/routes/transfer/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,11 @@ import ArrowLeftRight from "virtual:icons/lucide/arrow-left-right"
import RecipientField from "./(components)/recipient-field.svelte"
import CardSectionHeading from "./(components)/card-section-heading.svelte"
import { cosmosBalancesQuery, evmBalancesQuery } from "$lib/queries/balance"
import { derived } from "svelte/store";
import { chainsQuery } from "$lib/queries/chains.ts";
import { derived } from "svelte/store"
import { chainsQuery } from "$lib/queries/chains.ts"
export let data: PageData
let evmBalances: null | ReturnType<typeof evmBalancesQuery>
$: if ($sepoliaStore.address)
evmBalances = evmBalancesQuery({
Expand Down Expand Up @@ -67,8 +66,6 @@ $: if (
})
}
const queryParams = queryParameters(
{
"from-chain-id": {
Expand Down Expand Up @@ -118,62 +115,9 @@ onMount(() => {
})
})
let dialogOpenPast = false
let dialogOpenToken = false
let dialogOpenToChain = false
let dialogOpenFromChain = false
let dialogOpenSettings = false
let [chainSearch, chainSearchResults] = ["", chains]
// function handleChainSearch(event: InputEvent) {
// const target = event.target
// if (!(target instanceof HTMLInputElement)) return
// chainSearch = target.value
// chainSearchResults = chains.filter(chain =>
// chain.name.toLowerCase().includes(chainSearch.toLowerCase())
// )
// }
// queryParams["from-chain-id"]
// $: selectedFromChkain = chains.find(chain => chain.id === $queryParams["from-chain-id"])
// queryParams["to-chain-id"]
// $: selectedToChain = chains.find(chain => chain.id === $queryParams["to-chain-id"])
$: sepoliaAssets = $evmBalances?.data ?? []
// $: [tokenSearch, assetSearchResults] = [
// "",
// $queryParams["from-chain-id"] === "11155111" ? sepoliaAssets : unionBalances
// ]
// function handleAssetSearch(event: InputEvent) {
// const target = event.target
// if (!(target instanceof HTMLInputElement)) return
// tokenSearch = target.value
// assetSearchResults = sepoliaAssets.filter(asset =>
// asset.symbol.toLowerCase().includes(tokenSearch.toLowerCase())
// )
// }
// $: {
// assetSearchResults = $queryParams["from-chain-id"] === "11155111" ? sepoliaAssets : unionBalances
// }
const handleChainSelect = (name: string, target: "from-chain-id" | "to-chain-id") =>
{
console.log('chain name', name);
$queryParams[target] = name
;[dialogOpenFromChain, dialogOpenToChain, dialogOpenToken, dialogOpenSettings] = [
false,
false,
false,
false
]
}
function handleAssetSelect(id: string) {
// $queryParams["asset-id"] = assetSearchResults.find(asset => asset.symbol === id)?.address ?? ""
Expand Down Expand Up @@ -214,7 +158,7 @@ let buttonText = "Transfer" satisfies
<title>Union | Send</title>
</svelte:head>

{#if $chains && $chains.isSuccess }
{#if $chains && $chains.isSuccess && $evmBalances && $evmBalances.isSuccess && $cosmosBalances && !($cosmosBalances instanceof Error)}
<main
class="overflow-scroll flex justify-center size-full items-start px-0 sm:px-3 max-h-full sm:py-8"
>
Expand Down
112 changes: 56 additions & 56 deletions app/src/routes/transfer/+page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,62 +12,62 @@ interface Chain {
export const load = (_context => {
return {
// chains: [
// {
// name: "Union Testnet",
// id: "union-testnet-8",
// ecosystem: "cosmos",
// icon: "/images/icons/union.svg",
// live: true,
// assets: [
// {
// client: "07-tendermint-20",
// connection: "connection-7",
// channel: "channel-6",
// port: "wasm.union124t57vjgsyknnhmr3fpkmyvw2543448kpt2xhk5p5hxtmjjsrmzsjyc4n7",
// contractAddress: "union124t57vjgsyknnhmr3fpkmyvw2543448kpt2xhk5p5hxtmjjsrmzsjyc4n7",
// destination: "union-testnet-8",
// symbol: "OSMO"
// }
// ]
// },
// {
// name: "Sepolia",
// ecosystem: "evm",
// icon: "/images/icons/ethereum.svg",
// id: "11155111",
// live: true
// },
// {
// name: "Osmosis Testnet",
// ecosystem: "cosmos",
// icon: "/images/icons/osmosis.svg",
// id: "osmo-test-5",
// live: false,
// assets: [
// {
// port: "transfer",
// channel: "channel-7775",
// client: "08-wasm-3551",
// connection: "connection-3021",
// destination: "union-testnet-8",
// symbol: "OSMO"
// }
// ]
// },
// {
// name: "Stargaze Testnet",
// ecosystem: "cosmos",
// icon: "/images/icons/stargaze.svg",
// id: "stargaze-1",
// live: false
// },
// {
// name: "Scroll Testnet",
// ecosystem: "cosmos",
// icon: "/images/icons/scroll.svg",
// id: "534352",
// live: false
// }
// {
// name: "Union Testnet",
// id: "union-testnet-8",
// ecosystem: "cosmos",
// icon: "/images/icons/union.svg",
// live: true,
// assets: [
// {
// client: "07-tendermint-20",
// connection: "connection-7",
// channel: "channel-6",
// port: "wasm.union124t57vjgsyknnhmr3fpkmyvw2543448kpt2xhk5p5hxtmjjsrmzsjyc4n7",
// contractAddress: "union124t57vjgsyknnhmr3fpkmyvw2543448kpt2xhk5p5hxtmjjsrmzsjyc4n7",
// destination: "union-testnet-8",
// symbol: "OSMO"
// }
// ]
// },
// {
// name: "Sepolia",
// ecosystem: "evm",
// icon: "/images/icons/ethereum.svg",
// id: "11155111",
// live: true
// },
// {
// name: "Osmosis Testnet",
// ecosystem: "cosmos",
// icon: "/images/icons/osmosis.svg",
// id: "osmo-test-5",
// live: false,
// assets: [
// {
// port: "transfer",
// channel: "channel-7775",
// client: "08-wasm-3551",
// connection: "connection-3021",
// destination: "union-testnet-8",
// symbol: "OSMO"
// }
// ]
// },
// {
// name: "Stargaze Testnet",
// ecosystem: "cosmos",
// icon: "/images/icons/stargaze.svg",
// id: "stargaze-1",
// live: false
// },
// {
// name: "Scroll Testnet",
// ecosystem: "cosmos",
// icon: "/images/icons/scroll.svg",
// id: "534352",
// live: false
// }
// ] as Array<Chain>,
assets: assets as Array<Asset>
}
Expand Down
2 changes: 1 addition & 1 deletion typescript-sdk/playground/to-sepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const unoFromUnionToSepolia = await unionClient.transferAssets({
transfer: {
channel: "channel-23",
receiver: "0x8478B37E983F520dBCB5d7D3aAD8276B82631aBd".slice(2),
memo: "sending UNO from Union to Sepolia hahaha"
memo: "sending UNO from Union to Sepolia"
}
},
funds: [
Expand Down

0 comments on commit b480f95

Please sign in to comment.