Skip to content

Commit e437e06

Browse files
committed
chore: progress
1 parent 7852388 commit e437e06

File tree

20 files changed

+457
-578
lines changed

20 files changed

+457
-578
lines changed

app/app.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
{
1010
packages = {
1111
app = unstablePkgs.buildNpmPackage {
12-
npmDepsHash = "sha256-6U8sYT79+jLlWSFUrRxp34MgkHLN4UvOdntMtmGjkkY=";
12+
npmDepsHash = "sha256-o0iMZ4VvEDlj0OEoieLzZG4J2eeTF4EMRWrYI15e2RY=";
1313
src = ./.;
1414
sourceRoot = "app";
1515
npmFlags = [ "--legacy-peer-deps" ];

app/package-lock.json

Lines changed: 244 additions & 302 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"@tanstack/svelte-query": "^5.53.3",
2525
"@tanstack/svelte-query-persist-client": "^5.53.3",
2626
"@tanstack/svelte-table": "^8.20.5",
27-
"@union/client": "npm:@jsr/union__client@^0.0.8",
2827
"@tanstack/svelte-virtual": "^3.10.6",
28+
"@union/client": "npm:@jsr/union__client@^0.0.13",
2929
"@wagmi/connectors": "^5.1.8",
3030
"@wagmi/core": "^2.13.4",
3131
"bits-ui": "^0.21.13",

app/src/lib/components/chains-gate.svelte

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ let checkedChains: Readable<Array<Chain>> = derived(chains, $chains => {
4343
4444
let ucs1_configurations = chain.ucs1_configurations.reduce<Chain["ucs1_configurations"]>(
4545
(acc, item) => {
46-
let forwards = item.forwards.reduce<Record<string, (typeof item.forward)[number]>>(
46+
let forwards = item.forwards.reduce<Record<string, (typeof item.forwards)[number]>>(
4747
(acc2, item2) => {
48+
// @ts-expect-error
4849
acc2[item2.destination_chain.chain_id] = item2
4950
return acc2
5051
},
@@ -56,6 +57,7 @@ let checkedChains: Readable<Array<Chain>> = derived(chains, $chains => {
5657
forwards
5758
}
5859
60+
// @ts-expect-error
5961
acc[item.destination_chain.chain_id] = item_with_fwd
6062
6163
return acc
@@ -78,7 +80,7 @@ let checkedChains: Readable<Array<Chain>> = derived(chains, $chains => {
7880
assets: chain.assets.filter(
7981
asset => asset.display_symbol !== null && asset.decimals !== null && asset.denom !== null
8082
) as Chain["assets"]
81-
}
83+
} as Chain
8284
})
8385
})
8486
</script>

app/src/lib/utilities/types.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import type { Readable } from "svelte/store"
22

3+
export type Pretty<T> = { [K in keyof T]: T[K] } & {}
4+
5+
export type MaybePromise<TValue> = TValue | Promise<TValue>
6+
7+
export type TypeFromSet<T extends Set<any>> = T extends Set<infer U> ? U : never
8+
9+
export type ExtractParameters<T> = T extends new (..._args: infer P) => any ? P[0] : never
10+
311
export type AtLeastOne<T, U = T> = T extends any
412
? T | (U & Record<Exclude<keyof U, keyof T>, never>)
513
: never

app/src/routes/transfer/(components)/chain-dialog.svelte

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
<script lang="ts">
2+
import { toast } from "svelte-sonner"
23
import { cn } from "$lib/utilities/shadcn.ts"
3-
import * as Dialog from "$lib/components/ui/dialog"
4-
import { Button } from "$lib/components/ui/button/index.js"
54
import { Badge } from "$lib/components/ui/badge"
65
import type { UserAddresses } from "$lib/types.ts"
7-
import { toast } from "svelte-sonner"
6+
import * as Dialog from "$lib/components/ui/dialog"
7+
import { Button } from "$lib/components/ui/button/index.js"
88
99
export let kind: "from" | "to"
1010
export let dialogOpen = false
1111
export let onChainSelect: (newSelectedChain: string) => void
1212
export let chains: Array<{ chain_id: string; display_name: string; rpc_type: string }>
1313
export let selectedChain: string
14-
export let userAddr: UserAddresses | null
14+
export let userAddress: UserAddresses | null
1515
1616
$: document.body.style.overflow = dialogOpen ? "hidden" : "auto"
1717
1818
function selectChain(chain: { chain_id: string; display_name: string; rpc_type: string }) {
19-
if (chain.rpc_type === "evm" && !userAddr?.evm) {
19+
if (chain.rpc_type === "evm" && !userAddress?.evm) {
2020
toast.info(`Connect EVM wallet`)
2121
return
2222
}
2323
24-
if (chain.rpc_type === "cosmos" && !userAddr?.cosmos) {
24+
if (chain.rpc_type === "cosmos" && !userAddress?.cosmos) {
2525
toast.info(`Connect Cosmos wallet`)
2626
return
2727
}
@@ -36,55 +36,35 @@ function selectChain(chain: { chain_id: string; display_name: string; rpc_type:
3636
bind:open={dialogOpen}
3737
closeOnOutsideClick={true}
3838
>
39-
<Dialog.Content
40-
class={cn(
41-
'border-solid overflow-auto flex flex-col items-start p-0 pt-4 pb-2',
42-
)}
43-
>
39+
<Dialog.Content class={cn('border-solid overflow-auto flex flex-col items-start p-0 pt-4 pb-2')}>
4440
<Dialog.Header class="max-h-min p-2 w-full">
4541
<Dialog.Title class="px-2">
4642
Select {kind} Network
4743
</Dialog.Title>
4844
</Dialog.Header>
4945
<Dialog.Description class="size-full">
50-
<!--
51-
<div class="relative mr-auto flex-1 w-full">
52-
<Search class="absolute left-2.5 top-2.5 size-4 text-muted-foreground" />
53-
<Input
54-
type="search"
55-
pattern="[a-z]"
56-
autocorrect="off"
57-
spellcheck="false"
58-
autocapitalize="off"
59-
placeholder="choose origin chain"
60-
on:input={event => handleChainSearch(event)}
61-
class="w-full bg-current/95 pl-8 self-stretch lowercase focus-visible:ring-0 rounded-none focus-visible:outline-none border-x-0"
62-
/>
63-
</div>
64-
!-->
6546
<ul class="flex flex-col">
6647
{#each chains as chain, index}
6748
{@const selected = selectedChain === chain.chain_id}
68-
<li
69-
class={cn(
70-
'dark:text-accent-foreground flex flex-col',
71-
)}
72-
>
49+
<li class={cn('dark:text-accent-foreground flex flex-col')}>
7350
<Button
7451
variant={'ghost'}
75-
on:click={() => {selectChain(chain)}}
76-
class={cn('size-full px-4 py-2 w-full text-foreground rounded-none flex items-center justify-between dark:hover:text-black',
77-
selected ? 'bg-muted-foreground text-background' : ''
52+
on:click={() => {
53+
selectChain(chain)
54+
}}
55+
class={cn(
56+
'size-full px-4 py-2 w-full text-foreground rounded-none flex items-center justify-between dark:hover:text-black',
57+
selected ? 'bg-muted-foreground text-background' : '',
7858
)}
7959
>
8060
<span class="text-lg font-bold">
8161
{chain.display_name}
8262
</span>
83-
{#if (chain.rpc_type === "evm" && !userAddr?.evm) || (chain.rpc_type === "cosmos" && !userAddr?.cosmos) }
84-
<Badge variant={selected ? 'secondary' : 'default'}>Disconnected</Badge>
85-
{:else}
86-
<Badge variant={selected ? 'secondary' : 'default'}>Connected</Badge>
87-
{/if}
63+
{#if (chain.rpc_type === 'evm' && !userAddress?.evm) || (chain.rpc_type === 'cosmos' && !userAddress?.cosmos)}
64+
<Badge variant={selected ? 'secondary' : 'default'}>Disconnected</Badge>
65+
{:else}
66+
<Badge variant={selected ? 'secondary' : 'default'}>Connected</Badge>
67+
{/if}
8868
</Button>
8969
</li>
9070
{/each}

app/src/routes/transfer/(components)/recipient-field.svelte

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
<script lang="ts">
22
import type { Writable } from "svelte/store"
33
import { cn } from "$lib/utilities/shadcn.ts"
4-
import { sepoliaStore } from "$lib/wallet/evm"
5-
import { cosmosStore } from "$lib/wallet/cosmos"
64
import LockLockedIcon from "virtual:icons/lucide/lock"
75
import LockOpenIcon from "virtual:icons/lucide/lock-open"
86
import { Input } from "$lib/components/ui/input/index.ts"
@@ -12,12 +10,6 @@ export let recipient: Writable<string>
1210
1311
let recipientInputState: "locked" | "unlocked" | "invalid" = "unlocked"
1412
15-
const recipientAddressByChainId = (chainId?: string | null) => {
16-
if (!chainId) return ""
17-
if (chainId === "11155111") return $sepoliaStore.address
18-
return $cosmosStore.rawAddress
19-
}
20-
2113
const onUnlockClick = (_event: MouseEvent) => {
2214
if (recipientInputState === "locked") {
2315
$recipient = ""

0 commit comments

Comments
 (0)