Skip to content

Commit

Permalink
Add xApp network switch
Browse files Browse the repository at this point in the history
  • Loading branch information
WietseWind committed Dec 9, 2023
1 parent d3b8a43 commit e59fbc7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
xAppReceivedEventData,
payloadEventData,
qrEventData,
xAppNetworkSwitch,
destinationEventData,
xAppDomWindow,
xAppActionShare,
Expand Down Expand Up @@ -189,7 +190,7 @@ class xAppThread extends EventEmitter {

try {
const _event: xAppReceivedEventData = JSON.parse(rEvent?.data || "{}");
console.log('_event (typeof, {_event}) ', typeof _event, { _event });
console.log("_event (typeof, {_event}) ", typeof _event, { _event });

if (typeof _event === "object" && _event !== null) {
if (
Expand All @@ -208,6 +209,12 @@ class xAppThread extends EventEmitter {
case String(xAppEvents.scanQr):
this.emit("qr", _event as unknown as qrEventData);
break;
case String(xAppEvents.networkSwitch):
this.emit(
"networkswitch",
_event as unknown as xAppNetworkSwitch
);
break;
case String(xAppEvents.selectDestination):
this.emit(
"destination",
Expand Down
6 changes: 6 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export enum xAppEvents {
scanQr = "scanQr",
payloadResolved = "payloadResolved",
selectDestination = "selectDestination",
networkSwitch = "networkSwitch",
}

export interface qrEventData {
Expand Down Expand Up @@ -98,6 +99,11 @@ export interface xAppActionSelectDestination {
ignoreDestinationTag?: boolean;
}

export interface xAppNetworkSwitch {
// command: selectDestination
network?: string;
}

export interface xAppEnvironment {
version: string;
ott: string;
Expand Down

0 comments on commit e59fbc7

Please sign in to comment.