Skip to content
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
9 changes: 9 additions & 0 deletions src/globalValue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { broadcastChannelOptions } from "@toruslabs/base-controllers";
import { MethodType } from "@toruslabs/broadcast-channel";

(
broadcastChannelOptions as {
type?: MethodType;
webWorkerSupport: boolean;
}
).type = undefined;
3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// eslint-disable-next-line
import "@/globalValue";

import "@/main.css";

import { createGtm } from "@gtm-support/vue-gtm";
Expand Down
21 changes: 12 additions & 9 deletions src/modules/controllers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
BillboardEvent,
BROADCAST_CHANNELS,
BROADCAST_CHANNELS_MSGS,
broadcastChannelOptions,
Contact,
ContactPayload,
DEFAULT_PREFERENCES,
Expand Down Expand Up @@ -391,9 +392,10 @@ class ControllerModule extends VuexModule {
public async changeTheme(theme: "light" | "dark") {
const instanceId = new URLSearchParams(window.location.search).get("instanceId");
if (instanceId) {
const themeChannel = new BroadcastChannel<PopupData<ThemeChannelData>>(`${BROADCAST_CHANNELS.THEME_CHANGE}_${instanceId}`, {
webWorkerSupport: false,
});
const themeChannel = new BroadcastChannel<PopupData<ThemeChannelData>>(
`${BROADCAST_CHANNELS.THEME_CHANGE}_${instanceId}`,
broadcastChannelOptions
);
themeChannel.postMessage({
data: {
type: BROADCAST_CHANNELS_MSGS.SET_THEME,
Expand Down Expand Up @@ -558,9 +560,10 @@ class ControllerModule extends VuexModule {
torus.setOrigin(origin);
const instanceId = new URLSearchParams(window.location.search).get("instanceId");
if (instanceId) {
const logoutChannel = new BroadcastChannel<PopupData<BasePopupChannelData>>(`${BROADCAST_CHANNELS.WALLET_LOGOUT_CHANNEL}_${instanceId}`, {
webWorkerSupport: false,
});
const logoutChannel = new BroadcastChannel<PopupData<BasePopupChannelData>>(
`${BROADCAST_CHANNELS.WALLET_LOGOUT_CHANNEL}_${instanceId}`,
broadcastChannelOptions
);
logoutChannel.postMessage({
data: {
type: BROADCAST_CHANNELS_MSGS.LOGOUT,
Expand All @@ -586,7 +589,7 @@ class ControllerModule extends VuexModule {
if (instanceId) {
const networkChangeChannel = new BroadcastChannel<PopupData<NetworkChangeChannelData>>(
`${BROADCAST_CHANNELS.WALLET_NETWORK_CHANGE_CHANNEL}_${instanceId}`,
{ webWorkerSupport: false }
broadcastChannelOptions
);
networkChangeChannel.postMessage({
data: {
Expand All @@ -607,7 +610,7 @@ class ControllerModule extends VuexModule {
if (instanceId) {
const accountImportChannel = new BroadcastChannel<PopupData<AccountImportedChannelData>>(
`${BROADCAST_CHANNELS.WALLET_ACCOUNT_IMPORT_CHANNEL}_${instanceId}`,
{ webWorkerSupport: false }
broadcastChannelOptions
);
accountImportChannel.postMessage({
data: {
Expand Down Expand Up @@ -637,7 +640,7 @@ class ControllerModule extends VuexModule {
if (instanceId) {
const selectedAddressChannel = new BroadcastChannel<PopupData<SelectedAddresssChangeChannelData>>(
`${BROADCAST_CHANNELS.WALLET_SELECTED_ADDRESS_CHANNEL}_${instanceId}`,
{ webWorkerSupport: false }
broadcastChannelOptions
);
selectedAddressChannel.postMessage({
data: {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/Confirm.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { clusterApiUrl, Connection, TransactionMessage, VersionedMessage, VersionedTransaction } from "@solana/web3.js";
import { BROADCAST_CHANNELS, BroadcastChannelHandler, POPUP_RESULT } from "@toruslabs/base-controllers";
import { BROADCAST_CHANNELS, BroadcastChannelHandler, broadcastChannelOptions, POPUP_RESULT } from "@toruslabs/base-controllers";
import { BroadcastChannel } from "@toruslabs/broadcast-channel";
import log from "loglevel";
import { onErrorCaptured, onMounted, ref } from "vue";
Expand Down Expand Up @@ -84,7 +84,7 @@ onMounted(async () => {

const approveTxn = async (): Promise<void> => {
loading.value = true;
const bc = new BroadcastChannel(channel, { webWorkerSupport: false });
const bc = new BroadcastChannel(channel, broadcastChannelOptions);
await bc.postMessage({
data: { type: POPUP_RESULT, approve: true },
});
Expand All @@ -93,7 +93,7 @@ const approveTxn = async (): Promise<void> => {

const closeModal = async () => {
loading.value = true;
const bc = new BroadcastChannel(channel, { webWorkerSupport: false });
const bc = new BroadcastChannel(channel, broadcastChannelOptions);
await bc.postMessage({ data: { type: POPUP_RESULT, approve: false } });
bc.close();
};
Expand Down
6 changes: 3 additions & 3 deletions src/pages/ConfirmMessage.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { BROADCAST_CHANNELS, BroadcastChannelHandler, POPUP_RESULT } from "@toruslabs/base-controllers";
import { BROADCAST_CHANNELS, BroadcastChannelHandler, broadcastChannelOptions, POPUP_RESULT } from "@toruslabs/base-controllers";
import { BroadcastChannel } from "@toruslabs/broadcast-channel";
import log from "loglevel";
import { onErrorCaptured, onMounted, reactive, ref } from "vue";
Expand Down Expand Up @@ -44,7 +44,7 @@ onMounted(async () => {

const approveTxn = async (): Promise<void> => {
loading.value = true;
const bc = new BroadcastChannel(channel, { webWorkerSupport: false });
const bc = new BroadcastChannel(channel, broadcastChannelOptions);
await bc.postMessage({
data: { type: POPUP_RESULT, approve: true },
});
Expand All @@ -53,7 +53,7 @@ const approveTxn = async (): Promise<void> => {

const closeModal = async () => {
loading.value = true;
const bc = new BroadcastChannel(channel, { webWorkerSupport: false });
const bc = new BroadcastChannel(channel, broadcastChannelOptions);
await bc.postMessage({ data: { type: POPUP_RESULT, approve: false } });
bc.close();
};
Expand Down
4 changes: 2 additions & 2 deletions src/pages/End.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
import { Keypair } from "@solana/web3.js";
import { PopupData } from "@toruslabs/base-controllers";
import { broadcastChannelOptions, PopupData } from "@toruslabs/base-controllers";
import { BroadcastChannel } from "@toruslabs/broadcast-channel";
import { get } from "@toruslabs/http-helpers";
import { getED25519Key } from "@toruslabs/openlogin-ed25519";
Expand Down Expand Up @@ -45,7 +45,7 @@ const continueToApp = async (selectedIndex: number) => {
}

log.info(accounts);
const bc = new BroadcastChannel(channel, { webWorkerSupport: false });
const bc = new BroadcastChannel(channel, broadcastChannelOptions);
await bc.postMessage({
data: {
userInfo,
Expand Down
6 changes: 3 additions & 3 deletions src/pages/ProviderChange.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { BROADCAST_CHANNELS, BroadcastChannelHandler, POPUP_RESULT, PopupWhitelabelData } from "@toruslabs/base-controllers";
import { BROADCAST_CHANNELS, BroadcastChannelHandler, broadcastChannelOptions, POPUP_RESULT, PopupWhitelabelData } from "@toruslabs/base-controllers";
import { BroadcastChannel } from "@toruslabs/broadcast-channel";
import { onErrorCaptured, onMounted, reactive, ref } from "vue";

Expand Down Expand Up @@ -44,7 +44,7 @@ onMounted(async () => {

const approveProviderChange = async (): Promise<void> => {
loading.value = true;
const bc = new BroadcastChannel(channel, { webWorkerSupport: false });
const bc = new BroadcastChannel(channel, broadcastChannelOptions);
await bc.postMessage({
data: { type: POPUP_RESULT, approve: true },
});
Expand All @@ -53,7 +53,7 @@ const approveProviderChange = async (): Promise<void> => {

const denyProviderChange = async () => {
loading.value = true;
const bc = new BroadcastChannel(channel, { webWorkerSupport: false });
const bc = new BroadcastChannel(channel, broadcastChannelOptions);
await bc.postMessage({ data: { type: POPUP_RESULT, approve: false } });
bc.close();
};
Expand Down
Loading