From 63cbe752dda79f1c68099849de777a7517b5f7d5 Mon Sep 17 00:00:00 2001 From: hmalik88 Date: Mon, 18 Sep 2023 13:33:27 -0400 Subject: [PATCH] more fencing adjustment --- app/scripts/metamask-controller.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 2cc2fb1c3329..f0658adbc620 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -7,7 +7,7 @@ import { createEngineStream } from 'json-rpc-middleware-stream'; import { providerAsMiddleware } from '@metamask/eth-json-rpc-middleware'; import { debounce, - ///: BEGIN:ONLY_INCLUDE_IN(build-main) + ///: BEGIN:ONLY_INCLUDE_IN(snaps) throttle, ///: END:ONLY_INCLUDE_IN } from 'lodash'; @@ -228,6 +228,7 @@ import { securityProviderCheck } from './lib/security-provider-helpers'; import { IndexedDBPPOMStorage } from './lib/ppom/indexed-db-backend'; ///: END:ONLY_INCLUDE_IN import { updateCurrentLocale } from './translate'; +import { HandlerType } from '@metamask/snaps-utils'; export const METAMASK_CONTROLLER_EVENTS = { // Fired after state changes that impact the extension badge (unapproved msg count) @@ -1879,7 +1880,7 @@ export default class MetamaskController extends EventEmitter { } ///: END:ONLY_INCLUDE_IN - ///: BEGIN:ONLY_INCLUDE_IN(build-main) + ///: BEGIN:ONLY_INCLUDE_IN(snaps) /** * Tracks snaps export usage. Note: This function is throttled to 1 call per 60 seconds. * @@ -1912,8 +1913,12 @@ export default class MetamaskController extends EventEmitter { */ handleSnapRequest(args) { // we're not tracking at this point in flask because we eagerly fetch insights in v2 - ///: BEGIN:ONLY_INCLUDE_IN(build-main) - this._trackSnapExportUsage(args.snapId, args.handler); + ///: BEGIN:ONLY_INCLUDE_IN(build-flask) + if (args.handler !== HandlerType.OnTransaction) { + ///: END:ONLY_INCLUDE_IN + this._trackSnapExportUsage(args.snapId, args.handler); + ///: BEGIN:ONLY_INCLUDE_IN(build-flask) + } ///: END:ONLY_INCLUDE_IN return this.controllerMessenger.call('SnapController:handleRequest', args);