diff --git a/src/chrome/background/message-handler.ts b/src/chrome/background/message-handler.ts index e4add18d..e9f681e7 100644 --- a/src/chrome/background/message-handler.ts +++ b/src/chrome/background/message-handler.ts @@ -1,6 +1,6 @@ import { closePopup as closePopupFn } from 'chrome/helpers/close-popup' import { openParingPopup as openParingPopupFn } from 'chrome/helpers/open-pairing-popup' -import { errAsync, ok, okAsync, ResultAsync } from 'neverthrow' +import { errAsync, okAsync, ResultAsync } from 'neverthrow' import { AppLogger } from 'utils/logger' import { messageDiscriminator, @@ -17,14 +17,12 @@ import { LedgerTabWatcher } from './ledger-tab-watcher' import { ensureTab } from 'chrome/helpers/ensure-tab' import { focusTabByUrl } from 'chrome/helpers/focus-tab' import { createGatewayModule } from './create-gateway-module' -import { - notificationDispatcher, - WalletInteraction, -} from './notification-dispatcher' +import { notificationDispatcher } from './notification-dispatcher' import { getExtensionOptions } from 'options' import { chromeLocalStore } from 'chrome/helpers/chrome-local-store' import { RadixNetworkConfigById } from '@radixdlt/babylon-gateway-api-sdk' import { ConnectionsClient } from 'pairing/state/connections' +import { WalletInteraction } from '@radixdlt/radix-dapp-toolkit' export type BackgroundMessageHandler = ReturnType< typeof BackgroundMessageHandler diff --git a/src/chrome/background/notification-dispatcher.ts b/src/chrome/background/notification-dispatcher.ts index d5f4b74d..b5be74a0 100644 --- a/src/chrome/background/notification-dispatcher.ts +++ b/src/chrome/background/notification-dispatcher.ts @@ -1,30 +1,11 @@ import { TransactionStatus } from '@radixdlt/babylon-gateway-api-sdk' +import { WalletInteraction } from '@radixdlt/radix-dapp-toolkit' import { createNotification } from 'chrome/helpers/chrome-notifications' import { getShowDAppRequestNotifications, getShowTransactionResultNotifications, } from 'options' -export type WalletInteraction = { - interactionId: string - items: - | { - discriminator: 'transaction' | 'unauthorizedRequest' | 'cancelRequest' - } - | { - discriminator: 'authorizedRequest' - auth: { - discriminator: - | 'usePersona' - | 'loginWithChallenge' - | 'loginWithoutChallenge' - } - } - metadata: { - version: number - } -} - export const txNotificationPrefix = 'transaction' export const txNotificationSplitter = '___' export const notificationDispatcher = { diff --git a/src/chrome/helpers/validate-zod-schema.ts b/src/chrome/helpers/validate-zod-schema.ts deleted file mode 100644 index 90bdad21..00000000 --- a/src/chrome/helpers/validate-zod-schema.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Result, err, ok } from 'neverthrow' -import { logger } from 'utils/logger' - -export const validateZodSchema = ( - schema: Zod.Schema, - value: T, -): Result => { - try { - schema.parse(value) - return ok(value) - } catch (error) { - logger.error('Failed zod schema validation', schema.description ?? '') - return err({ reason: 'failedZodSchemaValidation', error }) - } -}