From 81da5c475e611d9a17ff4649f268fd7606402658 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Von=C3=A1=C5=A1ek?= Date: Tue, 17 Dec 2024 16:02:10 +0100 Subject: [PATCH] Sync queryparams in XCM --- .changeset/shy-schools-impress.md | 5 +++++ packages/apps/src/app/xcm/App.ts | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 .changeset/shy-schools-impress.md diff --git a/.changeset/shy-schools-impress.md b/.changeset/shy-schools-impress.md new file mode 100644 index 0000000000..b3f66a9a59 --- /dev/null +++ b/.changeset/shy-schools-impress.md @@ -0,0 +1,5 @@ +--- +'@galacticcouncil/apps': minor +--- + +Sync queryparams in XCM diff --git a/packages/apps/src/app/xcm/App.ts b/packages/apps/src/app/xcm/App.ts index 0a7f02afc9..714ec5853c 100644 --- a/packages/apps/src/app/xcm/App.ts +++ b/packages/apps/src/app/xcm/App.ts @@ -66,6 +66,7 @@ import { } from './types'; import styles from './App.css'; +import { updateQueryParams } from 'utils/url'; const Tag = xtags.Tag; @@ -243,6 +244,21 @@ export class XcmApp extends PoolApp { this.dispatchEvent(new CustomEvent('gc:wallet:change', options)); } + private updateQuery() { + const params = { + srcChain: this.transfer.srcChain.key, + destChain: this.transfer.destChain.key, + asset: this.transfer.srcAsset.key, + }; + updateQueryParams(params); + const options = { + bubbles: true, + composed: true, + detail: params, + }; + this.dispatchEvent(new CustomEvent('gc:query:update', options)); + } + private async changeChain() { this.disconnectSubscriptions(); this.clearTransferErrors(); @@ -252,6 +268,8 @@ export class XcmApp extends PoolApp { // Prefill & validation this.prefillAddress(); this.validateAddress(); + + this.updateQuery(); } private async switchChains() { @@ -309,6 +327,8 @@ export class XcmApp extends PoolApp { tags: tags || [], }); this._syncData(); + + this.updateQuery(); } updateAmount(amount: string) {