From faca6c24e8961020c4d7eb40bb034546af200a56 Mon Sep 17 00:00:00 2001 From: dan437 <80175477+dan437@users.noreply.github.com> Date: Fri, 3 Nov 2023 15:47:57 +0100 Subject: [PATCH] Add a new "userOptInV2" prop --- src/SmartTransactionsController.test.ts | 9 ++++++--- src/SmartTransactionsController.ts | 4 +++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/SmartTransactionsController.test.ts b/src/SmartTransactionsController.test.ts index 9eca48b3..94ecb95d 100644 --- a/src/SmartTransactionsController.test.ts +++ b/src/SmartTransactionsController.test.ts @@ -287,6 +287,7 @@ const defaultState = { [CHAIN_IDS.ETHEREUM]: [], }, userOptIn: undefined, + userOptInV2: undefined, fees: { approvalTxFees: undefined, tradeTxFees: undefined, @@ -496,15 +497,15 @@ describe('SmartTransactionsController', () => { it('sets optIn state', () => { smartTransactionsController.setOptInState(true); expect( - smartTransactionsController.state.smartTransactionsState.userOptIn, + smartTransactionsController.state.smartTransactionsState.userOptInV2, ).toBe(true); smartTransactionsController.setOptInState(false); expect( - smartTransactionsController.state.smartTransactionsState.userOptIn, + smartTransactionsController.state.smartTransactionsState.userOptInV2, ).toBe(false); smartTransactionsController.setOptInState(undefined); expect( - smartTransactionsController.state.smartTransactionsState.userOptIn, + smartTransactionsController.state.smartTransactionsState.userOptInV2, ).toBeUndefined(); }); }); @@ -611,6 +612,7 @@ describe('SmartTransactionsController', () => { [CHAIN_IDS.ETHEREUM]: [pendingTransaction], }, userOptIn: undefined, + userOptInV2: undefined, fees: { approvalTxFees: undefined, tradeTxFees: undefined, @@ -666,6 +668,7 @@ describe('SmartTransactionsController', () => { ], }, userOptIn: undefined, + userOptInV2: undefined, fees: { approvalTxFees: undefined, tradeTxFees: undefined, diff --git a/src/SmartTransactionsController.ts b/src/SmartTransactionsController.ts index 08aacd74..f554ba58 100644 --- a/src/SmartTransactionsController.ts +++ b/src/SmartTransactionsController.ts @@ -55,6 +55,7 @@ export type SmartTransactionsControllerState = BaseState & { smartTransactionsState: { smartTransactions: Record; userOptIn: boolean | undefined; + userOptInV2: boolean | undefined; liveness: boolean | undefined; fees: FeeEstimates; feesByChainId: Record; @@ -126,6 +127,7 @@ export default class SmartTransactionsController extends PollingControllerV1< smartTransactionsState: { smartTransactions: {}, userOptIn: undefined, + userOptInV2: undefined, fees: { approvalTxFees: undefined, tradeTxFees: undefined, @@ -232,7 +234,7 @@ export default class SmartTransactionsController extends PollingControllerV1< this.update({ smartTransactionsState: { ...this.state.smartTransactionsState, - userOptIn: state, + userOptInV2: state, }, }); }