Skip to content

Commit b21c8bf

Browse files
authored
Add a new "userOptInV2" prop (#222)
1 parent 697941a commit b21c8bf

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/SmartTransactionsController.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ const defaultState = {
287287
[CHAIN_IDS.ETHEREUM]: [],
288288
},
289289
userOptIn: undefined,
290+
userOptInV2: undefined,
290291
fees: {
291292
approvalTxFees: undefined,
292293
tradeTxFees: undefined,
@@ -496,15 +497,15 @@ describe('SmartTransactionsController', () => {
496497
it('sets optIn state', () => {
497498
smartTransactionsController.setOptInState(true);
498499
expect(
499-
smartTransactionsController.state.smartTransactionsState.userOptIn,
500+
smartTransactionsController.state.smartTransactionsState.userOptInV2,
500501
).toBe(true);
501502
smartTransactionsController.setOptInState(false);
502503
expect(
503-
smartTransactionsController.state.smartTransactionsState.userOptIn,
504+
smartTransactionsController.state.smartTransactionsState.userOptInV2,
504505
).toBe(false);
505506
smartTransactionsController.setOptInState(undefined);
506507
expect(
507-
smartTransactionsController.state.smartTransactionsState.userOptIn,
508+
smartTransactionsController.state.smartTransactionsState.userOptInV2,
508509
).toBeUndefined();
509510
});
510511
});
@@ -611,6 +612,7 @@ describe('SmartTransactionsController', () => {
611612
[CHAIN_IDS.ETHEREUM]: [pendingTransaction],
612613
},
613614
userOptIn: undefined,
615+
userOptInV2: undefined,
614616
fees: {
615617
approvalTxFees: undefined,
616618
tradeTxFees: undefined,
@@ -666,6 +668,7 @@ describe('SmartTransactionsController', () => {
666668
],
667669
},
668670
userOptIn: undefined,
671+
userOptInV2: undefined,
669672
fees: {
670673
approvalTxFees: undefined,
671674
tradeTxFees: undefined,

src/SmartTransactionsController.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export type SmartTransactionsControllerState = BaseState & {
5555
smartTransactionsState: {
5656
smartTransactions: Record<Hex, SmartTransaction[]>;
5757
userOptIn: boolean | undefined;
58+
userOptInV2: boolean | undefined;
5859
liveness: boolean | undefined;
5960
fees: FeeEstimates;
6061
feesByChainId: Record<Hex, FeeEstimates>;
@@ -126,6 +127,7 @@ export default class SmartTransactionsController extends PollingControllerV1<
126127
smartTransactionsState: {
127128
smartTransactions: {},
128129
userOptIn: undefined,
130+
userOptInV2: undefined,
129131
fees: {
130132
approvalTxFees: undefined,
131133
tradeTxFees: undefined,
@@ -232,7 +234,7 @@ export default class SmartTransactionsController extends PollingControllerV1<
232234
this.update({
233235
smartTransactionsState: {
234236
...this.state.smartTransactionsState,
235-
userOptIn: state,
237+
userOptInV2: state,
236238
},
237239
});
238240
}

0 commit comments

Comments
 (0)