Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show no quote token available in app #3638

Merged
merged 3 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/app.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ _: {
{
packages = {
app = jsPkgs.buildNpmPackage {
npmDepsHash = "sha256-z5AN/oqJSY2R2wAQx4RooCG/7P6AY41hyfmeW3ytEGc=";
npmDepsHash = "sha256-ZXPdOFx9IyZNGVbKXSBm1rDA3rkwgQYQROrAX35E09c=";
src = ./.;
sourceRoot = "app";
npmFlags = [
Expand Down
8 changes: 4 additions & 4 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@tanstack/svelte-query": "5.61.5",
"@tanstack/svelte-table": "^8.20.5",
"@tanstack/svelte-virtual": "3.10.9",
"@unionlabs/client": "0.0.52",
"@unionlabs/client": "0.0.53",
"@wagmi/connectors": "5.7.5",
"@wagmi/core": "2.16.3",
"bits-ui": "^0.21.13",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ export let stores: Props["stores"]
export let rotateTo: Props["rotateTo"]
export let chains: Array<Chain>
export let channel: Readable<Ucs03Channel | null>
export let transferArgs: {
baseToken: string
baseAmount: bigint
quoteToken: string
quoteAmount: bigint
receiver: string
sourceChannelId: number
ucs03address: string
} | null
export let transferArgs:
| {
baseToken: string
baseAmount: bigint
quoteToken: string
quoteAmount: bigint
receiver: string
sourceChannelId: number
ucs03address: string
}
| "NO_QUOTE_AVAILABLE"
| null

let { rawIntents, intents, validation } = stores
</script>
Expand Down Expand Up @@ -106,6 +109,8 @@ let { rawIntents, intents, validation } = stores
{:else}
{#if !transferArgs}
<LoadingDots/>
{:else if transferArgs === "NO_QUOTE_AVAILABLE"}
<div class="text-xs text-center">No Quote Token available for this transfer. Sending new assets to Cosmos is currently not supported and will be enabled in an update soon.</div>
{:else}
<div class="flex-1 flex flex-col items-center text-xs">
<Token amount={$rawIntents.amount} chainId={$rawIntents.destination} denom={transferArgs.quoteToken} {chains}/>
Expand Down
32 changes: 20 additions & 12 deletions app/src/lib/components/TransferFrom/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,19 @@ let channel = derived(rawIntents, $rawIntents => {
return getChannelInfo($rawIntents.source, $rawIntents.destination, ucs03channels)
})

let transferArgs: Writable<{
baseToken: string
baseAmount: bigint
quoteToken: string
quoteAmount: bigint
receiver: string
sourceChannelId: number
ucs03address: string
} | null> = writable(null)
let transferArgs: Writable<
| {
baseToken: string
baseAmount: bigint
quoteToken: string
quoteAmount: bigint
receiver: string
sourceChannelId: number
ucs03address: string
}
| "NO_QUOTE_AVAILABLE"
| null
> = writable(null)

rawIntents.subscribe(async () => {
transferArgs.set(null)
Expand All @@ -63,7 +67,13 @@ rawIntents.subscribe(async () => {
const quoteToken = await getQuoteToken($rawIntents.source, baseToken, $channel)

if (quoteToken.isErr()) {
return null
transferArgs.set(null)
return
}

if (quoteToken.value.type === "NO_QUOTE_AVAILABLE") {
transferArgs.set("NO_QUOTE_AVAILABLE")
return
}

const receiver =
Expand All @@ -76,8 +86,6 @@ rawIntents.subscribe(async () => {
? fromHex(`0x${$channel.source_port_id}`, "string")
: `0x${$channel.source_port_id}`

console.log("setting")

transferArgs.set({
baseToken,
baseAmount: BigInt($rawIntents.amount),
Expand Down
Loading