Skip to content

Commit

Permalink
Sync queryparams in XCM
Browse files Browse the repository at this point in the history
  • Loading branch information
jvonasek committed Dec 17, 2024
1 parent e4f71d4 commit 81da5c4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-schools-impress.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@galacticcouncil/apps': minor
---

Sync queryparams in XCM
20 changes: 20 additions & 0 deletions packages/apps/src/app/xcm/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ import {
} from './types';

import styles from './App.css';
import { updateQueryParams } from 'utils/url';

const Tag = xtags.Tag;

Expand Down Expand Up @@ -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();
Expand All @@ -252,6 +268,8 @@ export class XcmApp extends PoolApp {
// Prefill & validation
this.prefillAddress();
this.validateAddress();

this.updateQuery();
}

private async switchChains() {
Expand Down Expand Up @@ -309,6 +327,8 @@ export class XcmApp extends PoolApp {
tags: tags || [],
});
this._syncData();

this.updateQuery();
}

updateAmount(amount: string) {
Expand Down

0 comments on commit 81da5c4

Please sign in to comment.